{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1c70a61b-c566-4a8f-b0c1-0edc40ab8aec",
   "metadata": {},
   "source": [
    "## Vorlesung 2026-05-20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "111eda68-8e29-400d-862a-3e4dc8b28e70",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:20:15.572759Z",
     "iopub.status.busy": "2026-05-20T12:20:15.572454Z",
     "iopub.status.idle": "2026-05-20T12:20:15.916451Z",
     "shell.execute_reply": "2026-05-20T12:20:15.915492Z",
     "shell.execute_reply.started": "2026-05-20T12:20:15.572722Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "415a2648-4e20-4fc3-880c-82da496001fe",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:23:14.103144Z",
     "iopub.status.busy": "2026-05-20T12:23:14.102820Z",
     "iopub.status.idle": "2026-05-20T12:23:14.106849Z",
     "shell.execute_reply": "2026-05-20T12:23:14.105750Z",
     "shell.execute_reply.started": "2026-05-20T12:23:14.103113Z"
    }
   },
   "outputs": [],
   "source": [
    "url = \"https://data.hsbo.de/orders.csv\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3f0741cd-c7e5-43a0-acb1-2635ac8c0c78",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:29:26.048970Z",
     "iopub.status.busy": "2026-05-20T12:29:26.048670Z",
     "iopub.status.idle": "2026-05-20T12:29:26.133615Z",
     "shell.execute_reply": "2026-05-20T12:29:26.132778Z",
     "shell.execute_reply.started": "2026-05-20T12:29:26.048940Z"
    }
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv(url, sep=';')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "bec59025-a82e-48bc-82f0-1e86d8db28d6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:29:26.378695Z",
     "iopub.status.busy": "2026-05-20T12:29:26.378435Z",
     "iopub.status.idle": "2026-05-20T12:29:26.383941Z",
     "shell.execute_reply": "2026-05-20T12:29:26.382925Z",
     "shell.execute_reply.started": "2026-05-20T12:29:26.378668Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(234, 9)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "caa8afdf-b902-4b9e-8d29-1eb7de324e09",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:31:17.208301Z",
     "iopub.status.busy": "2026-05-20T12:31:17.207971Z",
     "iopub.status.idle": "2026-05-20T12:31:17.221950Z",
     "shell.execute_reply": "2026-05-20T12:31:17.220926Z",
     "shell.execute_reply.started": "2026-05-20T12:31:17.208270Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Datum</th>\n",
       "      <th>Uhrzeit</th>\n",
       "      <th>BestellungNr</th>\n",
       "      <th>KundeNr</th>\n",
       "      <th>Artikel_Gold</th>\n",
       "      <th>Artikel_Rot</th>\n",
       "      <th>Artikel_Blau</th>\n",
       "      <th>Artikel_Gruen</th>\n",
       "      <th>Betrag</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>09:55:41</td>\n",
       "      <td>77</td>\n",
       "      <td>78</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>09:59:09</td>\n",
       "      <td>78</td>\n",
       "      <td>79</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>10:00:27</td>\n",
       "      <td>79</td>\n",
       "      <td>80</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>10:02:22</td>\n",
       "      <td>80</td>\n",
       "      <td>81</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>10:03:11</td>\n",
       "      <td>81</td>\n",
       "      <td>82</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.15</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        Datum   Uhrzeit  BestellungNr  KundeNr  Artikel_Gold  Artikel_Rot  \\\n",
       "0  2023-10-12  09:55:41            77       78             0            0   \n",
       "1  2023-10-12  09:59:09            78       79             0            0   \n",
       "2  2023-10-12  10:00:27            79       80             1            0   \n",
       "3  2023-10-12  10:02:22            80       81             0            0   \n",
       "4  2023-10-12  10:03:11            81       82             0            0   \n",
       "\n",
       "   Artikel_Blau  Artikel_Gruen  Betrag  \n",
       "0             0              0    0.05  \n",
       "1             0              0    0.15  \n",
       "2             0              0    0.15  \n",
       "3             0              0    0.15  \n",
       "4             0              0    0.15  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b44cdfcd-fe81-4a6a-bf3e-b5b0981f540d",
   "metadata": {},
   "source": [
    "## Kugeln"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3811c11b-57a4-47a1-8d3d-24470c77a133",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:31:39.226361Z",
     "iopub.status.busy": "2026-05-20T12:31:39.226066Z",
     "iopub.status.idle": "2026-05-20T12:31:39.265142Z",
     "shell.execute_reply": "2026-05-20T12:31:39.264105Z",
     "shell.execute_reply.started": "2026-05-20T12:31:39.226332Z"
    }
   },
   "outputs": [],
   "source": [
    "kugeln = pd.read_csv('https://data.hsbo.de/kugeln.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "9b92b402-4f1f-406a-ab2c-07db96149e9c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:53:04.481278Z",
     "iopub.status.busy": "2026-05-20T12:53:04.480962Z",
     "iopub.status.idle": "2026-05-20T12:53:04.495391Z",
     "shell.execute_reply": "2026-05-20T12:53:04.494498Z",
     "shell.execute_reply.started": "2026-05-20T12:53:04.481249Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>R</th>\n",
       "      <th>G</th>\n",
       "      <th>B</th>\n",
       "      <th>I</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>564</td>\n",
       "      <td>16.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>59.0</td>\n",
       "      <td>gruen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>708</td>\n",
       "      <td>22.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>83.0</td>\n",
       "      <td>100.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>516</td>\n",
       "      <td>40.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>rot</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>527</td>\n",
       "      <td>62.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>77.0</td>\n",
       "      <td>rot</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>715</td>\n",
       "      <td>17.0</td>\n",
       "      <td>37.0</td>\n",
       "      <td>63.0</td>\n",
       "      <td>79.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    ID     R     G     B      I  label\n",
       "0  564  16.0  39.0  28.0   59.0  gruen\n",
       "1  708  22.0  48.0  83.0  100.0   blau\n",
       "2  516  40.0   7.0  12.0   50.0    rot\n",
       "3  527  62.0  11.0  19.0   77.0    rot\n",
       "4  715  17.0  37.0  63.0   79.0   blau"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kugeln.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "f480f32a-b24b-4157-be56-b57fc7eddb35",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:53:07.400456Z",
     "iopub.status.busy": "2026-05-20T12:53:07.400098Z",
     "iopub.status.idle": "2026-05-20T12:53:07.407238Z",
     "shell.execute_reply": "2026-05-20T12:53:07.406457Z",
     "shell.execute_reply.started": "2026-05-20T12:53:07.400425Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ID         int64\n",
       "R        float64\n",
       "G        float64\n",
       "B        float64\n",
       "I        float64\n",
       "label        str\n",
       "dtype: object"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kugeln.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "d98e3374-3b46-4b04-95be-f1a83014c137",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:55:58.044863Z",
     "iopub.status.busy": "2026-05-20T12:55:58.044619Z",
     "iopub.status.idle": "2026-05-20T12:55:58.057428Z",
     "shell.execute_reply": "2026-05-20T12:55:58.056927Z",
     "shell.execute_reply.started": "2026-05-20T12:55:58.044841Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>R</th>\n",
       "      <th>G</th>\n",
       "      <th>B</th>\n",
       "      <th>I</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>208.000000</td>\n",
       "      <td>208.000000</td>\n",
       "      <td>208.000000</td>\n",
       "      <td>208.000000</td>\n",
       "      <td>208.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>615.500000</td>\n",
       "      <td>48.663462</td>\n",
       "      <td>47.706731</td>\n",
       "      <td>47.341346</td>\n",
       "      <td>107.937500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>60.188592</td>\n",
       "      <td>29.335181</td>\n",
       "      <td>23.041352</td>\n",
       "      <td>22.861985</td>\n",
       "      <td>47.298936</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>512.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>12.000000</td>\n",
       "      <td>34.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>563.750000</td>\n",
       "      <td>16.000000</td>\n",
       "      <td>32.750000</td>\n",
       "      <td>23.000000</td>\n",
       "      <td>69.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>615.500000</td>\n",
       "      <td>59.000000</td>\n",
       "      <td>42.000000</td>\n",
       "      <td>48.000000</td>\n",
       "      <td>99.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>667.250000</td>\n",
       "      <td>70.250000</td>\n",
       "      <td>68.000000</td>\n",
       "      <td>66.000000</td>\n",
       "      <td>151.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>719.000000</td>\n",
       "      <td>142.000000</td>\n",
       "      <td>122.000000</td>\n",
       "      <td>106.000000</td>\n",
       "      <td>241.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               ID           R           G           B           I\n",
       "count  208.000000  208.000000  208.000000  208.000000  208.000000\n",
       "mean   615.500000   48.663462   47.706731   47.341346  107.937500\n",
       "std     60.188592   29.335181   23.041352   22.861985   47.298936\n",
       "min    512.000000    7.000000    7.000000   12.000000   34.000000\n",
       "25%    563.750000   16.000000   32.750000   23.000000   69.000000\n",
       "50%    615.500000   59.000000   42.000000   48.000000   99.000000\n",
       "75%    667.250000   70.250000   68.000000   66.000000  151.000000\n",
       "max    719.000000  142.000000  122.000000  106.000000  241.000000"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kugeln.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "6681671e-5082-44cc-ace8-7286b2647851",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:56:00.429106Z",
     "iopub.status.busy": "2026-05-20T12:56:00.428795Z",
     "iopub.status.idle": "2026-05-20T12:56:00.433989Z",
     "shell.execute_reply": "2026-05-20T12:56:00.433066Z",
     "shell.execute_reply.started": "2026-05-20T12:56:00.429076Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(208, 6)"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kugeln.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "96d57d20-ff0f-4b76-a6bd-4c6b405a93d0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:36:00.518919Z",
     "iopub.status.busy": "2026-05-20T12:36:00.518611Z",
     "iopub.status.idle": "2026-05-20T12:36:00.524225Z",
     "shell.execute_reply": "2026-05-20T12:36:00.523310Z",
     "shell.execute_reply.started": "2026-05-20T12:36:00.518889Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "142.0"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kugeln['R'].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "a80832b0-ecda-4d38-955b-0a40b0cb830c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:36:41.156365Z",
     "iopub.status.busy": "2026-05-20T12:36:41.156033Z",
     "iopub.status.idle": "2026-05-20T12:36:41.167090Z",
     "shell.execute_reply": "2026-05-20T12:36:41.166189Z",
     "shell.execute_reply.started": "2026-05-20T12:36:41.156332Z"
    }
   },
   "outputs": [],
   "source": [
    "summe = 0\n",
    "for i in range(len(kugeln)):\n",
    "    rot = kugeln.iloc[i, 1]\n",
    "    summe = summe + rot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "91fa92a5-6600-42f3-8901-5d1406a36de9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:36:46.614442Z",
     "iopub.status.busy": "2026-05-20T12:36:46.614131Z",
     "iopub.status.idle": "2026-05-20T12:36:46.619430Z",
     "shell.execute_reply": "2026-05-20T12:36:46.618532Z",
     "shell.execute_reply.started": "2026-05-20T12:36:46.614407Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(10122.0)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "summe"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "5693ba42-ff86-4206-bbdc-679368510c2c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:41:25.856549Z",
     "iopub.status.busy": "2026-05-20T12:41:25.856239Z",
     "iopub.status.idle": "2026-05-20T12:41:25.870564Z",
     "shell.execute_reply": "2026-05-20T12:41:25.869567Z",
     "shell.execute_reply.started": "2026-05-20T12:41:25.856519Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>R</th>\n",
       "      <th>G</th>\n",
       "      <th>B</th>\n",
       "      <th>I</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>564</td>\n",
       "      <td>16.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>59.0</td>\n",
       "      <td>gruen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>708</td>\n",
       "      <td>22.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>83.0</td>\n",
       "      <td>100.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>516</td>\n",
       "      <td>40.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>rot</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>527</td>\n",
       "      <td>62.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>77.0</td>\n",
       "      <td>rot</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>715</td>\n",
       "      <td>17.0</td>\n",
       "      <td>37.0</td>\n",
       "      <td>63.0</td>\n",
       "      <td>79.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    ID     R     G     B      I  label\n",
       "0  564  16.0  39.0  28.0   59.0  gruen\n",
       "1  708  22.0  48.0  83.0  100.0   blau\n",
       "2  516  40.0   7.0  12.0   50.0    rot\n",
       "3  527  62.0  11.0  19.0   77.0    rot\n",
       "4  715  17.0  37.0  63.0   79.0   blau"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kugeln.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "aef54cb2-b028-4a7e-b023-6a2b48be490a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:41:37.966445Z",
     "iopub.status.busy": "2026-05-20T12:41:37.966189Z",
     "iopub.status.idle": "2026-05-20T12:41:37.971263Z",
     "shell.execute_reply": "2026-05-20T12:41:37.970334Z",
     "shell.execute_reply.started": "2026-05-20T12:41:37.966421Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"gruen\" == \"blau\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "5660d0b5-7c2d-4e7e-aabd-4a93bd8c4f93",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:42:14.797679Z",
     "iopub.status.busy": "2026-05-20T12:42:14.797387Z",
     "iopub.status.idle": "2026-05-20T12:42:14.802635Z",
     "shell.execute_reply": "2026-05-20T12:42:14.801721Z",
     "shell.execute_reply.started": "2026-05-20T12:42:14.797648Z"
    }
   },
   "outputs": [],
   "source": [
    "filter = kugeln['label'] == 'blau'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "6df910b2-7352-4590-b28a-1b447404f26e",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:42:32.831558Z",
     "iopub.status.busy": "2026-05-20T12:42:32.831244Z",
     "iopub.status.idle": "2026-05-20T12:42:32.836773Z",
     "shell.execute_reply": "2026-05-20T12:42:32.835828Z",
     "shell.execute_reply.started": "2026-05-20T12:42:32.831528Z"
    }
   },
   "outputs": [],
   "source": [
    "blaueKugeln = kugeln[filter]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "36b86c80-d4a3-4445-b055-c84d85673445",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:42:46.922133Z",
     "iopub.status.busy": "2026-05-20T12:42:46.921827Z",
     "iopub.status.idle": "2026-05-20T12:42:46.937275Z",
     "shell.execute_reply": "2026-05-20T12:42:46.936276Z",
     "shell.execute_reply.started": "2026-05-20T12:42:46.922104Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>R</th>\n",
       "      <th>G</th>\n",
       "      <th>B</th>\n",
       "      <th>I</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>708</td>\n",
       "      <td>22.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>83.0</td>\n",
       "      <td>100.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>715</td>\n",
       "      <td>17.0</td>\n",
       "      <td>37.0</td>\n",
       "      <td>63.0</td>\n",
       "      <td>79.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>712</td>\n",
       "      <td>10.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>49.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>711</td>\n",
       "      <td>17.0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>65.0</td>\n",
       "      <td>78.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>700</td>\n",
       "      <td>19.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>71.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>blau</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     ID     R     G     B      I label\n",
       "1   708  22.0  48.0  83.0  100.0  blau\n",
       "4   715  17.0  37.0  63.0   79.0  blau\n",
       "7   712  10.0  23.0  39.0   49.0  blau\n",
       "24  711  17.0  38.0  65.0   78.0  blau\n",
       "32  700  19.0  41.0  71.0   86.0  blau"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "blaueKugeln.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "31e73887-c802-43e9-9161-c7a0f761ebe4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:43:28.165617Z",
     "iopub.status.busy": "2026-05-20T12:43:28.165285Z",
     "iopub.status.idle": "2026-05-20T12:43:28.171354Z",
     "shell.execute_reply": "2026-05-20T12:43:28.170356Z",
     "shell.execute_reply.started": "2026-05-20T12:43:28.165587Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(16.548387096774192)"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "blaueKugeln['R'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "c5fe46ec-60a4-4b10-bf2c-da6bfee0d479",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:45:14.452955Z",
     "iopub.status.busy": "2026-05-20T12:45:14.452651Z",
     "iopub.status.idle": "2026-05-20T12:45:14.482657Z",
     "shell.execute_reply": "2026-05-20T12:45:14.481521Z",
     "shell.execute_reply.started": "2026-05-20T12:45:14.452925Z"
    }
   },
   "outputs": [],
   "source": [
    "best = pd.read_csv('https://data.hsbo.de/Kundendaten.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "7cbba6f7-9c5f-4f1c-8460-ffc5b79b53c3",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:45:15.316696Z",
     "iopub.status.busy": "2026-05-20T12:45:15.316414Z",
     "iopub.status.idle": "2026-05-20T12:45:15.326449Z",
     "shell.execute_reply": "2026-05-20T12:45:15.325494Z",
     "shell.execute_reply.started": "2026-05-20T12:45:15.316665Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>KundeNr</th>\n",
       "      <th>Kundengruppe</th>\n",
       "      <th>Altersgruppe</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>272</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>278</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>6-10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>236</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>271</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>0-5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>263</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>11-20</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   KundeNr Kundengruppe Altersgruppe\n",
       "0      272  Mitarbeiter        41-50\n",
       "1      278    Schulkind         6-10\n",
       "2      236  Mitarbeiter        41-50\n",
       "3      271    Schulkind          0-5\n",
       "4      263    Schulkind        11-20"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "best.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "76d0f488-55d8-49e5-bfef-d71b00e7bda2",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:46:57.116491Z",
     "iopub.status.busy": "2026-05-20T12:46:57.116132Z",
     "iopub.status.idle": "2026-05-20T12:46:57.121161Z",
     "shell.execute_reply": "2026-05-20T12:46:57.120112Z",
     "shell.execute_reply.started": "2026-05-20T12:46:57.116460Z"
    }
   },
   "outputs": [],
   "source": [
    "filter = best['Kundengruppe'] == 'Mitarbeiter'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "f1c39e3c-4b72-406c-bac8-3fec0eb4cc4a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-05-20T12:47:00.717335Z",
     "iopub.status.busy": "2026-05-20T12:47:00.716992Z",
     "iopub.status.idle": "2026-05-20T12:47:00.728888Z",
     "shell.execute_reply": "2026-05-20T12:47:00.727681Z",
     "shell.execute_reply.started": "2026-05-20T12:47:00.717304Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>KundeNr</th>\n",
       "      <th>Kundengruppe</th>\n",
       "      <th>Altersgruppe</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>272</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>236</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>269</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>240</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>31-40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>242</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>21-30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>266</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>233</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>51-60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>241</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>31-40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>229</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>238</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>51-60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>234</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>31-40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>256</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>31-40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>215</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>31-40</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    KundeNr Kundengruppe Altersgruppe\n",
       "0       272  Mitarbeiter        41-50\n",
       "2       236  Mitarbeiter        41-50\n",
       "6       269  Mitarbeiter        41-50\n",
       "10      240  Mitarbeiter        31-40\n",
       "12      242  Mitarbeiter        21-30\n",
       "14      266  Mitarbeiter        41-50\n",
       "16      233  Mitarbeiter        51-60\n",
       "18      241  Mitarbeiter        31-40\n",
       "23      229  Mitarbeiter        41-50\n",
       "27      238  Mitarbeiter        51-60\n",
       "39      234  Mitarbeiter        31-40\n",
       "41      256  Mitarbeiter        31-40\n",
       "43      215  Mitarbeiter        31-40"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "best[filter]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2dc5fe3f-5411-4aea-a0e2-db1713e3f68a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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
}
