{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a5fc6b59-81ff-411c-aa21-9a72fe6bfe08",
   "metadata": {},
   "source": [
    "## Vorlesungsmitschrift 27.11.2024"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "d7e539ba-0ff4-4eec-ab94-869e67058b30",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T09:25:46.577864Z",
     "iopub.status.busy": "2024-11-27T09:25:46.577509Z",
     "iopub.status.idle": "2024-11-27T09:25:46.581981Z",
     "shell.execute_reply": "2024-11-27T09:25:46.581133Z",
     "shell.execute_reply.started": "2024-11-27T09:25:46.577836Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "9dead5ea-412a-4e54-8549-ff3364374ef9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T09:25:49.069294Z",
     "iopub.status.busy": "2024-11-27T09:25:49.068970Z",
     "iopub.status.idle": "2024-11-27T09:25:49.074567Z",
     "shell.execute_reply": "2024-11-27T09:25:49.073880Z",
     "shell.execute_reply.started": "2024-11-27T09:25:49.069267Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/tmp/ipykernel_3314/3630614186.py:1: UserWarning: Parsing dates in %d.%m.%Y %H:%M format when dayfirst=False (the default) was specified. Pass `dayfirst=True` or specify a format to silence this warning.\n",
      "  zeitstempel = pd.to_datetime('27.11.2024 09:05')\n"
     ]
    }
   ],
   "source": [
    "zeitstempel = pd.to_datetime('27.11.2024 09:05')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d2c04487-7a09-477c-8c0f-7ca1e0cf6ff2",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "d78f6a34-4a53-4bb0-9c16-3e70ec05e4b6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T09:25:49.878631Z",
     "iopub.status.busy": "2024-11-27T09:25:49.878307Z",
     "iopub.status.idle": "2024-11-27T09:25:49.884983Z",
     "shell.execute_reply": "2024-11-27T09:25:49.884318Z",
     "shell.execute_reply.started": "2024-11-27T09:25:49.878603Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2024-03-05 10:30:00')"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.to_datetime('3.5.2024 10:30', dayfirst=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "badfa9c0-dd6a-46ba-a220-f5670a00c3a9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T09:25:59.851886Z",
     "iopub.status.busy": "2024-11-27T09:25:59.851523Z",
     "iopub.status.idle": "2024-11-27T09:26:00.590021Z",
     "shell.execute_reply": "2024-11-27T09:26:00.589262Z",
     "shell.execute_reply.started": "2024-11-27T09:25:59.851857Z"
    }
   },
   "outputs": [],
   "source": [
    "kunden = pd.read_csv('https://data.hsbo.de/kunden.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c639a638-7c12-464d-a1d7-f9702d784e89",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "ba00b915-cd08-4c4f-9bea-459200e660a0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:12:13.799156Z",
     "iopub.status.busy": "2024-11-27T08:12:13.798817Z",
     "iopub.status.idle": "2024-11-27T08:12:13.812719Z",
     "shell.execute_reply": "2024-11-27T08:12:13.811954Z",
     "shell.execute_reply.started": "2024-11-27T08:12:13.799129Z"
    }
   },
   "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",
       "      <th>artikel</th>\n",
       "      <th>betrag</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",
       "      <td>3</td>\n",
       "      <td>0.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>278</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>6-10</td>\n",
       "      <td>3</td>\n",
       "      <td>0.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>236</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "      <td>2</td>\n",
       "      <td>0.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>271</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>0-5</td>\n",
       "      <td>2</td>\n",
       "      <td>0.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>263</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>11-20</td>\n",
       "      <td>4</td>\n",
       "      <td>0.10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   kundenr kundengruppe altersgruppe  artikel  betrag\n",
       "0      272  Mitarbeiter        41-50        3    0.10\n",
       "1      278    Schulkind         6-10        3    0.15\n",
       "2      236  Mitarbeiter        41-50        2    0.05\n",
       "3      271    Schulkind          0-5        2    0.05\n",
       "4      263    Schulkind        11-20        4    0.10"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kunden.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "c10e5e7f-bc11-4e4c-b451-c132046a4023",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:13:24.723634Z",
     "iopub.status.busy": "2024-11-27T08:13:24.723064Z",
     "iopub.status.idle": "2024-11-27T08:13:24.729587Z",
     "shell.execute_reply": "2024-11-27T08:13:24.728796Z",
     "shell.execute_reply.started": "2024-11-27T08:13:24.723599Z"
    }
   },
   "outputs": [],
   "source": [
    "kunden['umsatz'] = kunden['artikel'] * kunden['betrag']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "2e89ef72-00be-45d4-8785-41faff880f14",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:13:28.261543Z",
     "iopub.status.busy": "2024-11-27T08:13:28.261198Z",
     "iopub.status.idle": "2024-11-27T08:13:28.273850Z",
     "shell.execute_reply": "2024-11-27T08:13:28.273077Z",
     "shell.execute_reply.started": "2024-11-27T08:13:28.261516Z"
    }
   },
   "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",
       "      <th>artikel</th>\n",
       "      <th>betrag</th>\n",
       "      <th>umsatz</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",
       "      <td>3</td>\n",
       "      <td>0.10</td>\n",
       "      <td>0.30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>278</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>6-10</td>\n",
       "      <td>3</td>\n",
       "      <td>0.15</td>\n",
       "      <td>0.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>236</td>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>41-50</td>\n",
       "      <td>2</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>271</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>0-5</td>\n",
       "      <td>2</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>263</td>\n",
       "      <td>Schulkind</td>\n",
       "      <td>11-20</td>\n",
       "      <td>4</td>\n",
       "      <td>0.10</td>\n",
       "      <td>0.40</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   kundenr kundengruppe altersgruppe  artikel  betrag  umsatz\n",
       "0      272  Mitarbeiter        41-50        3    0.10    0.30\n",
       "1      278    Schulkind         6-10        3    0.15    0.45\n",
       "2      236  Mitarbeiter        41-50        2    0.05    0.10\n",
       "3      271    Schulkind          0-5        2    0.05    0.10\n",
       "4      263    Schulkind        11-20        4    0.10    0.40"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kunden.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "1d85b448-c8bc-4d6a-9cb0-798d52f1222f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:21:34.460562Z",
     "iopub.status.busy": "2024-11-27T08:21:34.460202Z",
     "iopub.status.idle": "2024-11-27T08:21:34.466424Z",
     "shell.execute_reply": "2024-11-27T08:21:34.465709Z",
     "shell.execute_reply.started": "2024-11-27T08:21:34.460533Z"
    }
   },
   "outputs": [],
   "source": [
    "kgUmsatz = kunden[['kundengruppe','umsatz']]\n",
    "kgNr = kunden[['kundengruppe','kundenr']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "4f6affe0-9dda-4c7f-9818-549888053e09",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:21:49.755755Z",
     "iopub.status.busy": "2024-11-27T08:21:49.755397Z",
     "iopub.status.idle": "2024-11-27T08:21:49.765982Z",
     "shell.execute_reply": "2024-11-27T08:21:49.765293Z",
     "shell.execute_reply.started": "2024-11-27T08:21:49.755728Z"
    }
   },
   "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",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>kundengruppe</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Gast</th>\n",
       "      <td>247.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>KigaKind</th>\n",
       "      <td>250.142857</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Mitarbeiter</th>\n",
       "      <td>243.923077</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Schulkind</th>\n",
       "      <td>266.263158</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Student</th>\n",
       "      <td>248.666667</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 kundenr\n",
       "kundengruppe            \n",
       "Gast          247.333333\n",
       "KigaKind      250.142857\n",
       "Mitarbeiter   243.923077\n",
       "Schulkind     266.263158\n",
       "Student       248.666667"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kgNr.groupby('kundengruppe')."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "92ae24d2-d65b-45cc-8b72-aac526f33e4a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:14:21.414694Z",
     "iopub.status.busy": "2024-11-27T08:14:21.414339Z",
     "iopub.status.idle": "2024-11-27T08:14:21.424545Z",
     "shell.execute_reply": "2024-11-27T08:14:21.423794Z",
     "shell.execute_reply.started": "2024-11-27T08:14:21.414665Z"
    }
   },
   "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>kundengruppe</th>\n",
       "      <th>umsatz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>0.30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Schulkind</td>\n",
       "      <td>0.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Mitarbeiter</td>\n",
       "      <td>0.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Schulkind</td>\n",
       "      <td>0.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Schulkind</td>\n",
       "      <td>0.40</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  kundengruppe  umsatz\n",
       "0  Mitarbeiter    0.30\n",
       "1    Schulkind    0.45\n",
       "2  Mitarbeiter    0.10\n",
       "3    Schulkind    0.10\n",
       "4    Schulkind    0.40"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kgUmsatz.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "8f994071-1475-4f49-8014-094a24c606fe",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:16:20.717521Z",
     "iopub.status.busy": "2024-11-27T08:16:20.717176Z",
     "iopub.status.idle": "2024-11-27T08:16:20.727741Z",
     "shell.execute_reply": "2024-11-27T08:16:20.726981Z",
     "shell.execute_reply.started": "2024-11-27T08:16:20.717494Z"
    }
   },
   "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>umsatz</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>kundengruppe</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Gast</th>\n",
       "      <td>0.95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>KigaKind</th>\n",
       "      <td>1.80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Mitarbeiter</th>\n",
       "      <td>2.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Schulkind</th>\n",
       "      <td>7.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Student</th>\n",
       "      <td>0.40</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              umsatz\n",
       "kundengruppe        \n",
       "Gast            0.95\n",
       "KigaKind        1.80\n",
       "Mitarbeiter     2.25\n",
       "Schulkind       7.00\n",
       "Student         0.40"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kgUmsatz.groupby('kundengruppe').sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "452ea74a-7795-4cd2-a8fe-5a196c1eeb19",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:26:01.572707Z",
     "iopub.status.busy": "2024-11-27T08:26:01.572486Z",
     "iopub.status.idle": "2024-11-27T08:26:01.603082Z",
     "shell.execute_reply": "2024-11-27T08:26:01.602703Z",
     "shell.execute_reply.started": "2024-11-27T08:26:01.572689Z"
    }
   },
   "outputs": [],
   "source": [
    "kuchen = pd.read_csv('https://data.hsbo.de/kuchen.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "cd470c4a-ef8b-45f2-8c91-6dfcac53eba8",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:26:09.150331Z",
     "iopub.status.busy": "2024-11-27T08:26:09.149970Z",
     "iopub.status.idle": "2024-11-27T08:26:09.160435Z",
     "shell.execute_reply": "2024-11-27T08:26:09.159774Z",
     "shell.execute_reply.started": "2024-11-27T08:26:09.150302Z"
    }
   },
   "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>BonNr</th>\n",
       "      <th>Apfelkuchen</th>\n",
       "      <th>Kirschkuchen</th>\n",
       "      <th>Sacher</th>\n",
       "      <th>Zitronenkuchen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>77</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>78</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>79</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>80</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>81</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        Datum  BonNr  Apfelkuchen  Kirschkuchen  Sacher  Zitronenkuchen\n",
       "0  2023-10-12     77            0             0       0               0\n",
       "1  2023-10-12     78            0             0       0               0\n",
       "2  2023-10-12     79            1             0       0               0\n",
       "3  2023-10-12     80            0             0       0               0\n",
       "4  2023-10-12     81            0             0       0               0"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kuchen.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "9cab7de1-0cfb-4075-b6dd-e1e449b254cc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:26:35.637273Z",
     "iopub.status.busy": "2024-11-27T08:26:35.636979Z",
     "iopub.status.idle": "2024-11-27T08:26:35.641103Z",
     "shell.execute_reply": "2024-11-27T08:26:35.640728Z",
     "shell.execute_reply.started": "2024-11-27T08:26:35.637259Z"
    }
   },
   "outputs": [],
   "source": [
    "kuchen['Datum'] = pd.to_datetime(kuchen['Datum'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "3b42ebf8-5995-4c00-a284-08d341fc5ad9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:26:39.436146Z",
     "iopub.status.busy": "2024-11-27T08:26:39.435880Z",
     "iopub.status.idle": "2024-11-27T08:26:39.444252Z",
     "shell.execute_reply": "2024-11-27T08:26:39.443688Z",
     "shell.execute_reply.started": "2024-11-27T08:26:39.436125Z"
    }
   },
   "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>BonNr</th>\n",
       "      <th>Apfelkuchen</th>\n",
       "      <th>Kirschkuchen</th>\n",
       "      <th>Sacher</th>\n",
       "      <th>Zitronenkuchen</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>77</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>78</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>79</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>80</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>81</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Datum  BonNr  Apfelkuchen  Kirschkuchen  Sacher  Zitronenkuchen\n",
       "0 2023-10-12     77            0             0       0               0\n",
       "1 2023-10-12     78            0             0       0               0\n",
       "2 2023-10-12     79            1             0       0               0\n",
       "3 2023-10-12     80            0             0       0               0\n",
       "4 2023-10-12     81            0             0       0               0"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kuchen.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "2a31e238-14c3-4f88-87cf-9d8a9554459d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:27:57.993173Z",
     "iopub.status.busy": "2024-11-27T08:27:57.992828Z",
     "iopub.status.idle": "2024-11-27T08:27:57.998660Z",
     "shell.execute_reply": "2024-11-27T08:27:57.997915Z",
     "shell.execute_reply.started": "2024-11-27T08:27:57.993146Z"
    }
   },
   "outputs": [],
   "source": [
    "kuchen['Gesamt'] = kuchen['Apfelkuchen'] +kuchen['Kirschkuchen'] + kuchen['Sacher'] +kuchen['Zitronenkuchen']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "a566e394-dcfa-4988-b229-653f9c952006",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:28:00.428652Z",
     "iopub.status.busy": "2024-11-27T08:28:00.428319Z",
     "iopub.status.idle": "2024-11-27T08:28:00.439221Z",
     "shell.execute_reply": "2024-11-27T08:28:00.438576Z",
     "shell.execute_reply.started": "2024-11-27T08:28:00.428605Z"
    }
   },
   "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>BonNr</th>\n",
       "      <th>Apfelkuchen</th>\n",
       "      <th>Kirschkuchen</th>\n",
       "      <th>Sacher</th>\n",
       "      <th>Zitronenkuchen</th>\n",
       "      <th>Gesamt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>77</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>78</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>79</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>80</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>81</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Datum  BonNr  Apfelkuchen  Kirschkuchen  Sacher  Zitronenkuchen  Gesamt\n",
       "0 2023-10-12     77            0             0       0               0       0\n",
       "1 2023-10-12     78            0             0       0               0       0\n",
       "2 2023-10-12     79            1             0       0               0       1\n",
       "3 2023-10-12     80            0             0       0               0       0\n",
       "4 2023-10-12     81            0             0       0               0       0"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kuchen.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "fff9567e-4af5-4df4-ad1d-1443ccface08",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T09:01:43.504572Z",
     "iopub.status.busy": "2024-11-27T09:01:43.504228Z",
     "iopub.status.idle": "2024-11-27T09:01:43.509958Z",
     "shell.execute_reply": "2024-11-27T09:01:43.509158Z",
     "shell.execute_reply.started": "2024-11-27T09:01:43.504545Z"
    }
   },
   "outputs": [],
   "source": [
    "kuchen['Wochentag'] = kuchen['Datum'].dt.day_name()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "69da9565-e3df-4560-a002-fda2c4abbe61",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:29:24.830771Z",
     "iopub.status.busy": "2024-11-27T08:29:24.830469Z",
     "iopub.status.idle": "2024-11-27T08:29:24.837706Z",
     "shell.execute_reply": "2024-11-27T08:29:24.837045Z",
     "shell.execute_reply.started": "2024-11-27T08:29:24.830742Z"
    }
   },
   "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>BonNr</th>\n",
       "      <th>Apfelkuchen</th>\n",
       "      <th>Kirschkuchen</th>\n",
       "      <th>Sacher</th>\n",
       "      <th>Zitronenkuchen</th>\n",
       "      <th>Gesamt</th>\n",
       "      <th>Wochentag</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>77</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Thursday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>78</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Thursday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>79</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Thursday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>80</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Thursday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2023-10-12</td>\n",
       "      <td>81</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Thursday</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Datum  BonNr  Apfelkuchen  Kirschkuchen  Sacher  Zitronenkuchen  \\\n",
       "0 2023-10-12     77            0             0       0               0   \n",
       "1 2023-10-12     78            0             0       0               0   \n",
       "2 2023-10-12     79            1             0       0               0   \n",
       "3 2023-10-12     80            0             0       0               0   \n",
       "4 2023-10-12     81            0             0       0               0   \n",
       "\n",
       "   Gesamt Wochentag  \n",
       "0       0  Thursday  \n",
       "1       0  Thursday  \n",
       "2       1  Thursday  \n",
       "3       0  Thursday  \n",
       "4       0  Thursday  "
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kuchen.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "18a33d58-e01a-4f5a-9d20-9b3b3a0c41c5",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:30:52.259413Z",
     "iopub.status.busy": "2024-11-27T08:30:52.259143Z",
     "iopub.status.idle": "2024-11-27T08:30:52.263880Z",
     "shell.execute_reply": "2024-11-27T08:30:52.263151Z",
     "shell.execute_reply.started": "2024-11-27T08:30:52.259394Z"
    }
   },
   "outputs": [],
   "source": [
    "wochentagGesamt = kuchen[['Wochentag','Gesamt']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "98b85c19-74cd-431a-933a-a80f185cb53f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:30:56.591752Z",
     "iopub.status.busy": "2024-11-27T08:30:56.591388Z",
     "iopub.status.idle": "2024-11-27T08:30:56.600296Z",
     "shell.execute_reply": "2024-11-27T08:30:56.599511Z",
     "shell.execute_reply.started": "2024-11-27T08:30:56.591724Z"
    }
   },
   "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>Wochentag</th>\n",
       "      <th>Gesamt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Thursday</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thursday</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Thursday</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Thursday</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Thursday</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Wochentag  Gesamt\n",
       "0  Thursday       0\n",
       "1  Thursday       0\n",
       "2  Thursday       1\n",
       "3  Thursday       0\n",
       "4  Thursday       0"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wochentagGesamt.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "4f094872-f135-4166-ba98-75cd05dab4c6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-27T08:31:12.921573Z",
     "iopub.status.busy": "2024-11-27T08:31:12.921207Z",
     "iopub.status.idle": "2024-11-27T08:31:12.931527Z",
     "shell.execute_reply": "2024-11-27T08:31:12.930874Z",
     "shell.execute_reply.started": "2024-11-27T08:31:12.921545Z"
    }
   },
   "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>Gesamt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Wochentag</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Friday</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Monday</th>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Saturday</th>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sunday</th>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Thursday</th>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Tuesday</th>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Wednesday</th>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Gesamt\n",
       "Wochentag        \n",
       "Friday         30\n",
       "Monday         24\n",
       "Saturday        0\n",
       "Sunday          0\n",
       "Thursday       11\n",
       "Tuesday        23\n",
       "Wednesday      63"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wochentagGesamt.groupby('Wochentag').sum()"
   ]
  }
 ],
 "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.11.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
