{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d741705b",
   "metadata": {},
   "source": [
    "# Boxplot Funktion (r_boxplot)\n",
    "\n",
    "Boxplot Funktion, weil GGB scheiße ist\n",
    "\n",
    "## Funktions Signatur\n",
    "\n",
    "```python\n",
    "def r_boxplot(arr: List[float], label: str) -> None:\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "280820ff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12508 characters]",
      "text/plain": [
       "<Figure size 600x250 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from typing import List\n",
    "\n",
    "def r_boxplot(arr: List[float], label: str) -> None:\n",
    "    data = np.asarray(arr, dtype=float)\n",
    "    p = np.percentile(data, [0, 25, 50, 75, 100])\n",
    "\n",
    "    fig, ax = plt.subplots(figsize=(6, 2.5))\n",
    "    ax.boxplot(data, positions=[1], vert=False, patch_artist=True, widths=0.6)\n",
    "\n",
    "    labels = [\"0%\", \"25%\", \"50%\", \"75%\", \"100%\"]\n",
    "    for val, lab in zip(p, labels):\n",
    "        ax.axvline(val, color=\"#ff0000\", linestyle=\"--\", linewidth=0.8, alpha=0.9)\n",
    "\n",
    "    ax.text(0.5, 1.15, label, transform=ax.transAxes,\n",
    "            ha=\"center\", va=\"bottom\", fontsize=10, fontweight=\"bold\", color=\"black\")\n",
    "\n",
    "    ax.set_yticks([1])\n",
    "    ax.xaxis.grid(True, linestyle=\"--\", alpha=0.3)\n",
    "\n",
    "    fig.tight_layout()\n",
    "    fig.subplots_adjust(top=0.78)\n",
    "    plt.show()\n",
    "\n",
    "def implementation() -> None:\n",
    "    # r_boxplot([1, 2, 3, 4, 5], \"Example Boxplot\")\n",
    "\n",
    "if __name__ == \"__main__\":    \n",
    "    implementation()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4ea5f68b",
   "metadata": {},
   "source": [
    "# r_stddev (Standardabweichung)\n",
    "\n",
    "Gibt die Standardabweichung als float zurück\n",
    "\n",
    "## Funktions Signatur\n",
    "\n",
    "```python\n",
    "def r_stddev(lst: list, r_dtype : Union[int, float]) -> Union[int, float]:\n",
    "```\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a3d44ce2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Standard Deviation with a ddof of 0 (just normal stddev): 1.4142135623730951\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from typing import Union\n",
    "\n",
    "def r_stddev(lst: list, r_dtype : Union[int, float], r_stichprobe: Union[int, float]) -> Union[int, float]:\n",
    "    r_arr = np.asarray(lst)\n",
    "\n",
    "    return np.std(\n",
    "        r_arr,\n",
    "        dtype=r_dtype,\n",
    "        ddof=r_stichprobe\n",
    "    )\n",
    "\n",
    "def implemenentation():\n",
    "    print(\"Standard Deviation with a ddof of 0 (just normal stddev): \" + \n",
    "        str(r_stddev([1, 2, 3, 4, 5], r_dtype=float, r_stichprobe=0))\n",
    "    )\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    implemenentation()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv (3.13.13)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
