{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6888baab-2ef2-4970-a50f-2b70a0b0a278",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5cfaa383-128a-4393-b089-316eed4a001b",
   "metadata": {},
   "outputs": [],
   "source": [
    "daten = pd.read_excel('Kurse/DataScience1/data/hundesteuer.xls')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "4fabcae8-438a-42f5-aa55-4b314a85c370",
   "metadata": {},
   "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>Steuernummer</th>\n",
       "      <th>Normalhunde</th>\n",
       "      <th>Kampfhunde</th>\n",
       "      <th>Preis</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1234</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>2880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1235</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>720</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1236</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Steuernummer  Normalhunde  Kampfhunde  Preis\n",
       "0          1234            3           5   2880\n",
       "1          1235            4           0    720\n",
       "2          1236            1           0    120"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "daten"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "eac302d5-3a3d-4ab4-b319-44109aaf5bf0",
   "metadata": {},
   "outputs": [],
   "source": [
    "def steuersatz(anzahlHunde):\n",
    "    if anzahlHunde == 1:\n",
    "        return 120\n",
    "    elif anzahlHunde <= 3:\n",
    "        return 150\n",
    "    else:\n",
    "        return 180"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "51a9a145-3056-47bb-b1a6-545ec8fa5880",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "180"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "steuersatz(8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a5dc45b1-226e-43cf-910b-42b52f994717",
   "metadata": {},
   "outputs": [],
   "source": [
    "def faktor(normalHunde, kampfHunde):\n",
    "    if normalHunde >= kampfHunde:\n",
    "        return 1\n",
    "    else:\n",
    "        return 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b82041a5-e970-4e40-8726-a984dd9c8758",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "faktor(2,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "b2049609-0071-439a-b99e-a89d12253b41",
   "metadata": {},
   "outputs": [],
   "source": [
    "def hundesteuer(anzahlNormalhunde, anzahlKampfhunde):\n",
    "    gesamtAnzahl = anzahlNormalhunde + anzahlKampfhunde\n",
    "\n",
    "    return gesamtAnzahl * steuersatz(gesamtAnzahl) * faktor(anzahlNormalhunde, anzahlKampfhunde)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "bd3b9d1a-2095-4385-9269-c56b61ead9fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2880"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hundesteuer(3, 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "858b5c36-2165-426f-be56-73df205fad98",
   "metadata": {},
   "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>Steuernummer</th>\n",
       "      <th>Normalhunde</th>\n",
       "      <th>Kampfhunde</th>\n",
       "      <th>Preis</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1234</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>2880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1235</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>720</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1236</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Steuernummer  Normalhunde  Kampfhunde  Preis\n",
       "0          1234            3           5   2880\n",
       "1          1235            4           0    720\n",
       "2          1236            1           0    120"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "daten"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "3b0655b6-fbc2-4d11-b2f8-07e4651e5e59",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2880"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hundesteuer( daten.iloc[0,1], daten.iloc[0, 2] )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "e875e1b8-a085-444c-84fa-158140c4b51d",
   "metadata": {},
   "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>Steuernummer</th>\n",
       "      <th>Normalhunde</th>\n",
       "      <th>Kampfhunde</th>\n",
       "      <th>Preis</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1234</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>2880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1235</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>720</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1236</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Steuernummer  Normalhunde  Kampfhunde  Preis\n",
       "0          1234            3           5   2880\n",
       "1          1235            4           0    720\n",
       "2          1236            1           0    120"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "daten"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "58832625-6cca-4861-9a50-a60a73569ead",
   "metadata": {},
   "outputs": [],
   "source": [
    "daten['Steuern'] = 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "914a3a55-7fba-4aa8-a6e8-e68e86c2c113",
   "metadata": {},
   "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>Steuernummer</th>\n",
       "      <th>Normalhunde</th>\n",
       "      <th>Kampfhunde</th>\n",
       "      <th>Preis</th>\n",
       "      <th>Steuern</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1234</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>2880</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1235</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>720</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1236</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>120</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Steuernummer  Normalhunde  Kampfhunde  Preis  Steuern\n",
       "0          1234            3           5   2880        0\n",
       "1          1235            4           0    720        0\n",
       "2          1236            1           0    120        0"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "daten"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "84b5597a-8e5f-4702-8b0c-049ac7d9e75f",
   "metadata": {},
   "outputs": [],
   "source": [
    "daten.iloc[0, 4] = hundesteuer( daten.iloc[0, 1], daten.iloc[0,2] )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "67a499fe-959a-48ae-a8eb-0f6ec61fdd96",
   "metadata": {},
   "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>Steuernummer</th>\n",
       "      <th>Normalhunde</th>\n",
       "      <th>Kampfhunde</th>\n",
       "      <th>Preis</th>\n",
       "      <th>Steuern</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1234</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>2880</td>\n",
       "      <td>2880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1235</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>720</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1236</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>120</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Steuernummer  Normalhunde  Kampfhunde  Preis  Steuern\n",
       "0          1234            3           5   2880     2880\n",
       "1          1235            4           0    720        0\n",
       "2          1236            1           0    120        0"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "daten"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "764d70ce-5751-4ba9-b5a8-62baf9ff8a88",
   "metadata": {},
   "outputs": [],
   "source": [
    "daten.iloc[1, 4] = hundesteuer( daten.iloc[1, 1], daten.iloc[1,2] )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "614a2e51-4eac-4409-bb42-4a3bf4ce0899",
   "metadata": {},
   "outputs": [],
   "source": [
    "daten.iloc[2, 4] = hundesteuer( daten.iloc[2, 1], daten.iloc[2,2] )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "5ac98dd1-2f55-400c-b8f1-7b33fe50cb0a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n"
     ]
    }
   ],
   "source": [
    "for zeilennummer in range(3):\n",
    "    print(zeilennummer)\n",
    "    daten.iloc[zeilennummer, 4] = hundesteuer( daten.iloc[zeilennummer, 1], daten.iloc[zeilennummer,2] )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "f3bbc87e-09e4-4e0e-aa1b-24593d8f3a76",
   "metadata": {},
   "outputs": [],
   "source": [
    "anzahlZeilen = len(daten)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "720133d4-cc80-4488-93b7-9782ef6a9f77",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n"
     ]
    }
   ],
   "source": [
    "print(anzahlZeilen)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "8d7eab35-9d82-4f90-9384-4590850db0f5",
   "metadata": {},
   "outputs": [],
   "source": [
    "zeilen = daten.shape[0]\n",
    "spalten = daten.shape[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1cfad8ca-092c-4ae0-bc5c-730c0f370607",
   "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.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
