{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "91e5d121-4267-4ee7-baaa-3cec3da1f869",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from collections import namedtuple\n",
    "\n",
    "from pathlib import Path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f7c989c6-67e1-4c34-bd08-34d6626cd33a",
   "metadata": {},
   "outputs": [],
   "source": [
    "N_SAMPLES = 1000\n",
    "SEED = 42\n",
    "RNG = np.random.default_rng(seed=SEED)\n",
    "COLS_DUMMY_DATA = ['type', 'problem', 'action']\n",
    "TOTAL_POSSIBILITY_FAILURES = 0.4\n",
    "TYPE_MAPPING = {\n",
    "    'Reguläre Wartung': 'Wartung',\n",
    "    'Unerwarteter Fehler': 'Störungsmeldung',\n",
    "}\n",
    "OBJ_IDS_2_TXT = {\n",
    "    1: 'Fräsmaschine-FS435X',\n",
    "    2: 'Schleifmaschine-S4x87',\n",
    "    3: 'Bohrbearbeitungszentrum-BBZ35',\n",
    "}\n",
    "STARTING_DATE = pd.to_datetime('2022-01-01')\n",
    "ENDING_DATE = pd.to_datetime('2024-08-07')\n",
    "DATASET_FEATURES = [\n",
    "    'VorgangsID',\n",
    "    'ObjektID',\n",
    "    'HObjektText',\n",
    "    'VorgangsTypName',\n",
    "    'VorgangsBeschreibung',\n",
    "    'ErledigungsBeschreibung',\n",
    "    'ErstellungsDatum',\n",
    "    'VorgangsDatum',\n",
    "    'Arbeitsbeginn',\n",
    "    'ErledigungsDatum',\n",
    "]\n",
    "DF_SKELLETON = {feat: [] for feat in DATASET_FEATURES}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0be70014-4fe0-45dd-8bd5-f731bd12cfe1",
   "metadata": {},
   "outputs": [],
   "source": [
    "source = '../data/Dummy_Data.xlsx'\n",
    "dest = f'../data/Dummy_Dataset_N_{N_SAMPLES}.csv'\n",
    "pth_source = Path(source)\n",
    "pth_dest = Path(dest)\n",
    "assert pth_source.exists()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "193304e9-9db1-4697-ae48-836a716ce80e",
   "metadata": {},
   "outputs": [],
   "source": [
    "def read_dummy_data(pth_data, columns=COLS_DUMMY_DATA):\n",
    "    data = pd.read_excel(pth_data)\n",
    "    data.columns = columns.copy()\n",
    "    \n",
    "    return data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "85ac2d6c-4eee-429a-8511-82f39d4e8716",
   "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>type</th>\n",
       "      <th>problem</th>\n",
       "      <th>action</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Reguläre Wartung</td>\n",
       "      <td>Schmierung der Lager</td>\n",
       "      <td>Nachfüllen des Schmiermittels</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Unerwarteter Fehler</td>\n",
       "      <td>Motorüberhitzung</td>\n",
       "      <td>Austausch des Kühlgebläses</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Reguläre Wartung</td>\n",
       "      <td>Überprüfung der Hydraulik</td>\n",
       "      <td>Reinigung und Nachfüllen der Hydraulikflüssigkeit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Unerwarteter Fehler</td>\n",
       "      <td>Elektronikfehler</td>\n",
       "      <td>Austausch der defekten Platine</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Reguläre Wartung</td>\n",
       "      <td>Kalibrierung der Sensoren</td>\n",
       "      <td>Justierung und Test der Sensoren</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  type                    problem  \\\n",
       "0     Reguläre Wartung       Schmierung der Lager   \n",
       "1  Unerwarteter Fehler           Motorüberhitzung   \n",
       "2     Reguläre Wartung  Überprüfung der Hydraulik   \n",
       "3  Unerwarteter Fehler           Elektronikfehler   \n",
       "4     Reguläre Wartung  Kalibrierung der Sensoren   \n",
       "\n",
       "                                              action  \n",
       "0                      Nachfüllen des Schmiermittels  \n",
       "1                         Austausch des Kühlgebläses  \n",
       "2  Reinigung und Nachfüllen der Hydraulikflüssigkeit  \n",
       "3                     Austausch der defekten Platine  \n",
       "4                   Justierung und Test der Sensoren  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = read_dummy_data(pth_source)\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "aa6d3af2-31c7-44ee-a3a8-4201b559038f",
   "metadata": {},
   "outputs": [],
   "source": [
    "def make_subset(data, target_type, type_mapping=TYPE_MAPPING):\n",
    "    Entry = namedtuple('ProblemActionPairs', ['type', 'problem', 'action'])\n",
    "    entries = []\n",
    "    data_subset = data.loc[data['type']==target_type,:].copy()\n",
    "\n",
    "    for row in data_subset.itertuples(index=False):\n",
    "        type_mapped = type_mapping[row.type]\n",
    "        entries.append(Entry(type_mapped, row.problem, row.action))\n",
    "\n",
    "    return entries"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "79bb0e96-3e04-458e-bbfb-dbd11a5386b9",
   "metadata": {},
   "source": [
    "## Activity Types\n",
    "\n",
    "- relevant activity types:\n",
    "    - 'Reparaturauftrag (Portal)'\n",
    "    - 'Störungsmeldung'\n",
    "    - 'Wartung'\n",
    "- ``regular`` --> 'Wartung'\n",
    "- ``failures`` --> 'Störungsmeldung'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2ec7a69d-80a6-4ede-928f-3ad933d3e090",
   "metadata": {},
   "source": [
    "### Failures"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "668c0275-c8d8-4390-8857-a2ada566d786",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[ProblemActionPairs(type='Störungsmeldung', problem='Motorüberhitzung', action='Austausch des Kühlgebläses'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Elektronikfehler', action='Austausch der defekten Platine'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Getriebeausfall', action='Reparatur und Austausch der beschädigten Zahnräder'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Leckage in der Hydraulikleitung', action='Abdichtung der Leckstelle und Nachfüllen der Hydraulikflüssigkeit'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Ausfall der Steuerungseinheit', action='Neustart und Software-Update der Steuerungseinheit'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Bruch eines Zahnriemens', action='Austausch des Zahnriemens'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Kurzschluss im Schaltschrank', action='Austausch der Sicherungen und Kabel'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Vibrationsprobleme am Motor', action='Auswuchten des Motors und Austausch der Dämpfer'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Fehlfunktion der Hydraulikpumpe', action='Austausch der Hydraulikpumpe'),\n",
       " ProblemActionPairs(type='Störungsmeldung', problem='Bruch eines Förderbands', action='Austausch des Förderbands')]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "failures = make_subset(data, target_type='Unerwarteter Fehler')\n",
    "failures[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f784dba-5e0a-41aa-9005-3e310fda47cb",
   "metadata": {},
   "source": [
    "### Regular Maintenance"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "d4b8ca4a-4230-463e-bb74-f965b0732155",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[ProblemActionPairs(type='Wartung', problem='Schmierung der Lager', action='Nachfüllen des Schmiermittels'),\n",
       " ProblemActionPairs(type='Wartung', problem='Überprüfung der Hydraulik', action='Reinigung und Nachfüllen der Hydraulikflüssigkeit'),\n",
       " ProblemActionPairs(type='Wartung', problem='Kalibrierung der Sensoren', action='Justierung und Test der Sensoren'),\n",
       " ProblemActionPairs(type='Wartung', problem='Reinigung der Luftfilter', action='Austausch der Luftfilter'),\n",
       " ProblemActionPairs(type='Wartung', problem='Überprüfung der Sicherheitsvorrichtungen', action='Funktionstest und Justierung der Sicherheitsvorrichtungen'),\n",
       " ProblemActionPairs(type='Wartung', problem='Inspektion der Förderbänder', action='Einstellung und Austausch abgenutzter Teile'),\n",
       " ProblemActionPairs(type='Wartung', problem='Überprüfung der Druckventile', action='Reinigung und Einstellung der Druckventile'),\n",
       " ProblemActionPairs(type='Wartung', problem='Test der Not-Aus-Schalter', action='Test und Austausch defekter Not-Aus-Schalter'),\n",
       " ProblemActionPairs(type='Wartung', problem='Überprüfung der Kühlmittelsysteme', action='Nachfüllen und Entlüftung des Kühlmittelsystems'),\n",
       " ProblemActionPairs(type='Wartung', problem='Kontrolle der Lichtschranken', action='Reinigung und Neujustierung der Lichtschranken')]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "regular = make_subset(data, target_type='Reguläre Wartung')\n",
    "regular[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aaf5b6bd-a7bf-4c6b-a969-566cd90d2353",
   "metadata": {},
   "source": [
    "## ObjectIDs and HObjektTexts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "bf2d380d-4103-40b0-a99d-7770e73a9ef5",
   "metadata": {},
   "outputs": [],
   "source": [
    "def random_objects(mapping, rng, n_samples):\n",
    "    max_val = max(mapping.keys())\n",
    "    rands = rng.integers(1, max_val+1, size=n_samples)\n",
    "\n",
    "    obj_ids = rands.tolist()\n",
    "    texts =[mapping[obj_id] for obj_id in obj_ids]\n",
    "\n",
    "    return obj_ids, texts"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "708521a4-a93c-4d29-9be7-19a29fd8aa7d",
   "metadata": {},
   "source": [
    "## Random Dates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "bff4fc9e-7a61-42df-abcb-1540e2d04b80",
   "metadata": {},
   "outputs": [],
   "source": [
    "def random_dates(start, end, rng, n_samples):\n",
    "\n",
    "    start_u = start.value//10**9\n",
    "    end_u = end.value//10**9\n",
    "    days_to_finish = rng.exponential(1.3, n_samples).astype(np.int_)\n",
    "    td = pd.to_timedelta(days_to_finish, unit='day')\n",
    "\n",
    "    creation_dates = pd.to_datetime(rng.integers(start_u, end_u, n_samples), unit='s').normalize()\n",
    "    done_dates = creation_dates + td\n",
    "\n",
    "    return creation_dates.to_list(), done_dates.to_list()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d2a77202-0eb9-4390-89af-e8e60e5a1e34",
   "metadata": {},
   "source": [
    "## Random descriptions"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d360fe54-36f2-4f35-a42c-7ca09a7599c3",
   "metadata": {},
   "source": [
    "proportions:\n",
    "- regular: 0.6\n",
    "- failure: 0.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "626a290b-a3ee-4c37-a754-b29ecca59f70",
   "metadata": {},
   "outputs": [],
   "source": [
    "def random_descriptions(failures, regular, target_prop_fail, rng, n_samples):\n",
    "    poss_per_entry_fail = target_prop_fail / len(failures)\n",
    "    poss_per_entry_regular = (1 - target_prop_fail) / len(regular)\n",
    "\n",
    "    failure_possibilities = np.full(len(failures), poss_per_entry_fail)\n",
    "    regular_possibilities = np.full(len(regular), poss_per_entry_regular)\n",
    "    possibilities = np.concatenate((failure_possibilities, regular_possibilities))\n",
    "\n",
    "    content_descriptions = failures.copy()\n",
    "    content_descriptions.extend(regular.copy())\n",
    "\n",
    "    return rng.choice(content_descriptions, size=n_samples, p=possibilities)\n",
    "\n",
    "def description_parts(descriptions):\n",
    "    types = descriptions[:,0].tolist()\n",
    "    todo = descriptions[:,1].tolist()\n",
    "    dones = descriptions[:,2].tolist()\n",
    "\n",
    "    return types, todo, dones"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d8999cba-a460-4f67-901f-b7936f04cd74",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "39f72300-d73b-431f-89ee-af85e7bcdccc",
   "metadata": {},
   "source": [
    "# Complete Dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "8eb838de-d28e-4499-a63a-a708a58e0c6f",
   "metadata": {},
   "outputs": [],
   "source": [
    "def create_dataset(df_skelleton, type_failure, type_regular, starting_date, ending_date, rng, n_samples):\n",
    "    df_dict = df_skelleton.copy()\n",
    "    \n",
    "    failures = make_subset(data, target_type=type_failure)\n",
    "    regular = make_subset(data, target_type=type_regular)\n",
    "    \n",
    "    event_ids = list(range(1,n_samples+1))\n",
    "    obj_ids, txts = random_objects(OBJ_IDS_2_TXT, rng, n_samples)\n",
    "    creation_dates, done_dates = random_dates(starting_date, ending_date, rng, n_samples)\n",
    "    process_date = creation_dates.copy()\n",
    "    done_start_date = done_dates.copy()\n",
    "    descriptions = random_descriptions(failures, regular, TOTAL_POSSIBILITY_FAILURES, rng, n_samples)\n",
    "    types, todo, dones = description_parts(descriptions)\n",
    "\n",
    "    df_dict.update(\n",
    "        VorgangsID=event_ids,\n",
    "        ObjektID=obj_ids,\n",
    "        HObjektText=txts,\n",
    "        VorgangsTypName=types,\n",
    "        VorgangsBeschreibung=todo,\n",
    "        ErledigungsBeschreibung=dones,\n",
    "        ErstellungsDatum=creation_dates,\n",
    "        VorgangsDatum=process_date,\n",
    "        Arbeitsbeginn=done_start_date,\n",
    "        ErledigungsDatum=done_dates,\n",
    "    )\n",
    "    df = pd.DataFrame.from_dict(df_dict)\n",
    "    df = df.sort_values(by='ErstellungsDatum', ascending=True)\n",
    "    df = df.reset_index(drop=True)\n",
    "    df['VorgangsID'] = event_ids\n",
    "\n",
    "    return df.copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "195775b3-e44a-4d80-92bc-799093bd4ef2",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = create_dataset(\n",
    "    df_skelleton=DF_SKELLETON,\n",
    "    type_failure='Unerwarteter Fehler',\n",
    "    type_regular='Reguläre Wartung',\n",
    "    starting_date=STARTING_DATE,\n",
    "    ending_date=ENDING_DATE,\n",
    "    rng=RNG,\n",
    "    n_samples=N_SAMPLES,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "d3182c98-b57a-4619-aa41-8ab4a90bd1f2",
   "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>VorgangsID</th>\n",
       "      <th>ObjektID</th>\n",
       "      <th>HObjektText</th>\n",
       "      <th>VorgangsTypName</th>\n",
       "      <th>VorgangsBeschreibung</th>\n",
       "      <th>ErledigungsBeschreibung</th>\n",
       "      <th>ErstellungsDatum</th>\n",
       "      <th>VorgangsDatum</th>\n",
       "      <th>Arbeitsbeginn</th>\n",
       "      <th>ErledigungsDatum</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>Ölleckage durch undichten Ölsumpf</td>\n",
       "      <td>Abdichtung und Austausch des Ölsumpfs</td>\n",
       "      <td>2022-01-01</td>\n",
       "      <td>2022-01-01</td>\n",
       "      <td>2022-01-01</td>\n",
       "      <td>2022-01-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Überprüfung der Schwingungsdämpfer</td>\n",
       "      <td>Austausch und Justierung der Schwingungsdämpfer</td>\n",
       "      <td>2022-01-03</td>\n",
       "      <td>2022-01-03</td>\n",
       "      <td>2022-01-03</td>\n",
       "      <td>2022-01-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>Fräsmaschine-FS435X</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Überprüfung der Kühlmittelsysteme</td>\n",
       "      <td>Nachfüllen und Entlüftung des Kühlmittelsystems</td>\n",
       "      <td>2022-01-05</td>\n",
       "      <td>2022-01-05</td>\n",
       "      <td>2022-01-05</td>\n",
       "      <td>2022-01-05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>Bohrbearbeitungszentrum-BBZ35</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>Blockierung der Förderschnecke</td>\n",
       "      <td>Beseitigung der Blockierung und Überprüfung de...</td>\n",
       "      <td>2022-01-06</td>\n",
       "      <td>2022-01-06</td>\n",
       "      <td>2022-01-07</td>\n",
       "      <td>2022-01-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "      <td>Bohrbearbeitungszentrum-BBZ35</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>Überhitzung durch mangelnde Kühlmittelzirkulation</td>\n",
       "      <td>Reinigung der Leitungen und Austausch des Kühl...</td>\n",
       "      <td>2022-01-06</td>\n",
       "      <td>2022-01-06</td>\n",
       "      <td>2022-01-09</td>\n",
       "      <td>2022-01-09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>996</td>\n",
       "      <td>1</td>\n",
       "      <td>Fräsmaschine-FS435X</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Test der Not-Aus-Schalter</td>\n",
       "      <td>Test und Austausch defekter Not-Aus-Schalter</td>\n",
       "      <td>2024-08-03</td>\n",
       "      <td>2024-08-03</td>\n",
       "      <td>2024-08-03</td>\n",
       "      <td>2024-08-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>997</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>Fehlfunktion der Hydraulikpumpe</td>\n",
       "      <td>Austausch der Hydraulikpumpe</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-06</td>\n",
       "      <td>2024-08-06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>998</td>\n",
       "      <td>3</td>\n",
       "      <td>Bohrbearbeitungszentrum-BBZ35</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Kalibrierung der Sensoren</td>\n",
       "      <td>Justierung und Test der Sensoren</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-07</td>\n",
       "      <td>2024-08-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>999</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Überprüfung der Hydraulikzylinder</td>\n",
       "      <td>Nachjustierung und Schmierung der Hydraulikzyl...</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>1000</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Inspektion der Schutzabdeckungen</td>\n",
       "      <td>Reparatur und Austausch beschädigter Abdeckungen</td>\n",
       "      <td>2024-08-06</td>\n",
       "      <td>2024-08-06</td>\n",
       "      <td>2024-08-07</td>\n",
       "      <td>2024-08-07</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     VorgangsID  ObjektID                    HObjektText  VorgangsTypName  \\\n",
       "0             1         2          Schleifmaschine-S4x87  Störungsmeldung   \n",
       "1             2         2          Schleifmaschine-S4x87          Wartung   \n",
       "2             3         1            Fräsmaschine-FS435X          Wartung   \n",
       "3             4         3  Bohrbearbeitungszentrum-BBZ35  Störungsmeldung   \n",
       "4             5         3  Bohrbearbeitungszentrum-BBZ35  Störungsmeldung   \n",
       "..          ...       ...                            ...              ...   \n",
       "995         996         1            Fräsmaschine-FS435X          Wartung   \n",
       "996         997         2          Schleifmaschine-S4x87  Störungsmeldung   \n",
       "997         998         3  Bohrbearbeitungszentrum-BBZ35          Wartung   \n",
       "998         999         2          Schleifmaschine-S4x87          Wartung   \n",
       "999        1000         2          Schleifmaschine-S4x87          Wartung   \n",
       "\n",
       "                                  VorgangsBeschreibung  \\\n",
       "0                    Ölleckage durch undichten Ölsumpf   \n",
       "1                   Überprüfung der Schwingungsdämpfer   \n",
       "2                    Überprüfung der Kühlmittelsysteme   \n",
       "3                       Blockierung der Förderschnecke   \n",
       "4    Überhitzung durch mangelnde Kühlmittelzirkulation   \n",
       "..                                                 ...   \n",
       "995                          Test der Not-Aus-Schalter   \n",
       "996                    Fehlfunktion der Hydraulikpumpe   \n",
       "997                          Kalibrierung der Sensoren   \n",
       "998                  Überprüfung der Hydraulikzylinder   \n",
       "999                   Inspektion der Schutzabdeckungen   \n",
       "\n",
       "                               ErledigungsBeschreibung ErstellungsDatum  \\\n",
       "0                Abdichtung und Austausch des Ölsumpfs       2022-01-01   \n",
       "1      Austausch und Justierung der Schwingungsdämpfer       2022-01-03   \n",
       "2      Nachfüllen und Entlüftung des Kühlmittelsystems       2022-01-05   \n",
       "3    Beseitigung der Blockierung und Überprüfung de...       2022-01-06   \n",
       "4    Reinigung der Leitungen und Austausch des Kühl...       2022-01-06   \n",
       "..                                                 ...              ...   \n",
       "995       Test und Austausch defekter Not-Aus-Schalter       2024-08-03   \n",
       "996                       Austausch der Hydraulikpumpe       2024-08-05   \n",
       "997                   Justierung und Test der Sensoren       2024-08-05   \n",
       "998  Nachjustierung und Schmierung der Hydraulikzyl...       2024-08-05   \n",
       "999   Reparatur und Austausch beschädigter Abdeckungen       2024-08-06   \n",
       "\n",
       "    VorgangsDatum Arbeitsbeginn ErledigungsDatum  \n",
       "0      2022-01-01    2022-01-01       2022-01-01  \n",
       "1      2022-01-03    2022-01-03       2022-01-03  \n",
       "2      2022-01-05    2022-01-05       2022-01-05  \n",
       "3      2022-01-06    2022-01-07       2022-01-07  \n",
       "4      2022-01-06    2022-01-09       2022-01-09  \n",
       "..            ...           ...              ...  \n",
       "995    2024-08-03    2024-08-03       2024-08-03  \n",
       "996    2024-08-05    2024-08-06       2024-08-06  \n",
       "997    2024-08-05    2024-08-07       2024-08-07  \n",
       "998    2024-08-05    2024-08-05       2024-08-05  \n",
       "999    2024-08-06    2024-08-07       2024-08-07  \n",
       "\n",
       "[1000 rows x 10 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "2bb03fdb-ea45-46a1-81b4-525f7568355c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# df.to_excel(pth_dest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "ff9f6f80-b709-4011-89fe-90c8812d7e7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv(pth_dest, sep=';', encoding='cp1252', index=False, date_format='%d.%m.%Y')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e2871889-f128-419c-8e89-d8eb48ceb2e1",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "cdba82ad-d4d1-4266-ad41-8d90bb059956",
   "metadata": {},
   "source": [
    "# Check processed data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "af26cd9b-e5d1-46e1-b269-ac46de10dfe2",
   "metadata": {},
   "outputs": [],
   "source": [
    "pth_to_data = '../scripts/results/dummy_N_1000/'\n",
    "pth_to_data = Path(pth_to_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "c7338787-716c-43c0-9d11-03567459f594",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[WindowsPath('../scripts/results/dummy_N_1000/Pipe-TargetFeature_Step-3_remove_NA.pkl'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TIMELINE.pkl'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/Pipe-TargetFeature_Step-5_analyse_feature.pkl'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TOKEN_ANALYSIS.pkl'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TK-GRAPH_POSTPROCESSING.pkl'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TokenGraph.graphml'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TK-GRAPH_ANALYSIS.pkl'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TokenGraph-filtered.graphml'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TK-GRAPH_ANALYSIS_RESCALED.pkl'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TokenGraph-directed-rescaled.graphml'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/TokenGraph-undirected-rescaled.graphml'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/token_graph.svg'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/token_graph_sub_1.svg'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/token_graph_sub_2.svg'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/token_graph_sub_3.svg'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/token_graph_sub_4.svg'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/token_graph_sub_5.svg'),\n",
       " WindowsPath('../scripts/results/dummy_N_1000/Pipe-Graph_Static-Rendering_Step-6_build_subnetworks.pkl')]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "files = list(pth_to_data.glob(r'*'))\n",
    "files"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "1dd0da25-9097-46a1-bac8-dce281e17c5b",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\transformers\\utils\\generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
      "  _torch_pytree._register_pytree_node(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2024-08-07 13:37:19 +0000 | lang_main:io:INFO | Loaded TOML config file successfully.\n"
     ]
    }
   ],
   "source": [
    "from lang_main import io"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "33ae3e52-f638-40a0-b243-6578cde52a19",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "WindowsPath('../scripts/results/dummy_N_1000/TIMELINE.pkl')"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "files[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "fc598842-f218-4895-8d1e-20b09f9e6d12",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2024-08-07 13:51:31 +0000 | lang_main:io:INFO | Loaded file successfully.\n"
     ]
    }
   ],
   "source": [
    "(data,) = io.load_pickle(files[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "3cbffa6c-4199-4a9f-b041-3c34fdbc7266",
   "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>VorgangsID</th>\n",
       "      <th>ObjektID</th>\n",
       "      <th>HObjektText</th>\n",
       "      <th>VorgangsTypName</th>\n",
       "      <th>VorgangsBeschreibung</th>\n",
       "      <th>ErledigungsBeschreibung</th>\n",
       "      <th>ErstellungsDatum</th>\n",
       "      <th>VorgangsDatum</th>\n",
       "      <th>Arbeitsbeginn</th>\n",
       "      <th>ErledigungsDatum</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>Ölleckage durch undichten Ölsumpf</td>\n",
       "      <td>Abdichtung und Austausch des Ölsumpfs</td>\n",
       "      <td>2022-01-01</td>\n",
       "      <td>2022-01-01</td>\n",
       "      <td>2022-01-01</td>\n",
       "      <td>2022-01-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Überprüfung der Schwingungsdämpfer</td>\n",
       "      <td>Austausch und Justierung der Schwingungsdämpfer</td>\n",
       "      <td>2022-01-03</td>\n",
       "      <td>2022-01-03</td>\n",
       "      <td>2022-01-03</td>\n",
       "      <td>2022-01-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>Fräsmaschine-FS435X</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Überprüfung der Kühlmittelsysteme</td>\n",
       "      <td>Nachfüllen und Entlüftung des Kühlmittelsystems</td>\n",
       "      <td>2022-01-05</td>\n",
       "      <td>2022-01-05</td>\n",
       "      <td>2022-01-05</td>\n",
       "      <td>2022-01-05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>Bohrbearbeitungszentrum-BBZ35</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>Blockierung der Förderschnecke</td>\n",
       "      <td>Beseitigung der Blockierung und Überprüfung de...</td>\n",
       "      <td>2022-01-06</td>\n",
       "      <td>2022-01-06</td>\n",
       "      <td>2022-01-07</td>\n",
       "      <td>2022-01-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "      <td>Bohrbearbeitungszentrum-BBZ35</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>Überhitzung durch mangelnde Kühlmittelzirkulation</td>\n",
       "      <td>Reinigung der Leitungen und Austausch des Kühl...</td>\n",
       "      <td>2022-01-06</td>\n",
       "      <td>2022-01-06</td>\n",
       "      <td>2022-01-09</td>\n",
       "      <td>2022-01-09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>996</td>\n",
       "      <td>1</td>\n",
       "      <td>Fräsmaschine-FS435X</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Test der Not-Aus-Schalter</td>\n",
       "      <td>Test und Austausch defekter Not-Aus-Schalter</td>\n",
       "      <td>2024-08-03</td>\n",
       "      <td>2024-08-03</td>\n",
       "      <td>2024-08-03</td>\n",
       "      <td>2024-08-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>997</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>Fehlfunktion der Hydraulikpumpe</td>\n",
       "      <td>Austausch der Hydraulikpumpe</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-06</td>\n",
       "      <td>2024-08-06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>998</td>\n",
       "      <td>3</td>\n",
       "      <td>Bohrbearbeitungszentrum-BBZ35</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Kalibrierung der Sensoren</td>\n",
       "      <td>Justierung und Test der Sensoren</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-07</td>\n",
       "      <td>2024-08-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>999</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Überprüfung der Hydraulikzylinder</td>\n",
       "      <td>Nachjustierung und Schmierung der Hydraulikzyl...</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "      <td>2024-08-05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>1000</td>\n",
       "      <td>2</td>\n",
       "      <td>Schleifmaschine-S4x87</td>\n",
       "      <td>Wartung</td>\n",
       "      <td>Inspektion der Schutzabdeckungen</td>\n",
       "      <td>Reparatur und Austausch beschädigter Abdeckungen</td>\n",
       "      <td>2024-08-06</td>\n",
       "      <td>2024-08-06</td>\n",
       "      <td>2024-08-07</td>\n",
       "      <td>2024-08-07</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     VorgangsID  ObjektID                    HObjektText  VorgangsTypName  \\\n",
       "0             1         2          Schleifmaschine-S4x87  Störungsmeldung   \n",
       "1             2         2          Schleifmaschine-S4x87          Wartung   \n",
       "2             3         1            Fräsmaschine-FS435X          Wartung   \n",
       "3             4         3  Bohrbearbeitungszentrum-BBZ35  Störungsmeldung   \n",
       "4             5         3  Bohrbearbeitungszentrum-BBZ35  Störungsmeldung   \n",
       "..          ...       ...                            ...              ...   \n",
       "995         996         1            Fräsmaschine-FS435X          Wartung   \n",
       "996         997         2          Schleifmaschine-S4x87  Störungsmeldung   \n",
       "997         998         3  Bohrbearbeitungszentrum-BBZ35          Wartung   \n",
       "998         999         2          Schleifmaschine-S4x87          Wartung   \n",
       "999        1000         2          Schleifmaschine-S4x87          Wartung   \n",
       "\n",
       "                                  VorgangsBeschreibung  \\\n",
       "0                    Ölleckage durch undichten Ölsumpf   \n",
       "1                   Überprüfung der Schwingungsdämpfer   \n",
       "2                    Überprüfung der Kühlmittelsysteme   \n",
       "3                       Blockierung der Förderschnecke   \n",
       "4    Überhitzung durch mangelnde Kühlmittelzirkulation   \n",
       "..                                                 ...   \n",
       "995                          Test der Not-Aus-Schalter   \n",
       "996                    Fehlfunktion der Hydraulikpumpe   \n",
       "997                          Kalibrierung der Sensoren   \n",
       "998                  Überprüfung der Hydraulikzylinder   \n",
       "999                   Inspektion der Schutzabdeckungen   \n",
       "\n",
       "                               ErledigungsBeschreibung ErstellungsDatum  \\\n",
       "0                Abdichtung und Austausch des Ölsumpfs       2022-01-01   \n",
       "1      Austausch und Justierung der Schwingungsdämpfer       2022-01-03   \n",
       "2      Nachfüllen und Entlüftung des Kühlmittelsystems       2022-01-05   \n",
       "3    Beseitigung der Blockierung und Überprüfung de...       2022-01-06   \n",
       "4    Reinigung der Leitungen und Austausch des Kühl...       2022-01-06   \n",
       "..                                                 ...              ...   \n",
       "995       Test und Austausch defekter Not-Aus-Schalter       2024-08-03   \n",
       "996                       Austausch der Hydraulikpumpe       2024-08-05   \n",
       "997                   Justierung und Test der Sensoren       2024-08-05   \n",
       "998  Nachjustierung und Schmierung der Hydraulikzyl...       2024-08-05   \n",
       "999   Reparatur und Austausch beschädigter Abdeckungen       2024-08-06   \n",
       "\n",
       "    VorgangsDatum Arbeitsbeginn ErledigungsDatum  \n",
       "0      2022-01-01    2022-01-01       2022-01-01  \n",
       "1      2022-01-03    2022-01-03       2022-01-03  \n",
       "2      2022-01-05    2022-01-05       2022-01-05  \n",
       "3      2022-01-06    2022-01-07       2022-01-07  \n",
       "4      2022-01-06    2022-01-09       2022-01-09  \n",
       "..            ...           ...              ...  \n",
       "995    2024-08-03    2024-08-03       2024-08-03  \n",
       "996    2024-08-05    2024-08-06       2024-08-06  \n",
       "997    2024-08-05    2024-08-07       2024-08-07  \n",
       "998    2024-08-05    2024-08-05       2024-08-05  \n",
       "999    2024-08-06    2024-08-07       2024-08-07  \n",
       "\n",
       "[1000 rows x 10 columns]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "fd422d51-6118-47aa-80a1-6e80819a3205",
   "metadata": {},
   "outputs": [],
   "source": [
    "t = data.copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "4225af01-b9df-4b27-aae2-b06257b0dd3a",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "Can only use .dt accessor with datetimelike values",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[37], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mt\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mErledigungsDatum\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdt\u001b[49m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\generic.py:6299\u001b[0m, in \u001b[0;36mNDFrame.__getattr__\u001b[1;34m(self, name)\u001b[0m\n\u001b[0;32m   6292\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[0;32m   6293\u001b[0m     name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_internal_names_set\n\u001b[0;32m   6294\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_metadata\n\u001b[0;32m   6295\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_accessors\n\u001b[0;32m   6296\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_info_axis\u001b[38;5;241m.\u001b[39m_can_hold_identifiers_and_holds_name(name)\n\u001b[0;32m   6297\u001b[0m ):\n\u001b[0;32m   6298\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m[name]\n\u001b[1;32m-> 6299\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mobject\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__getattribute__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\accessor.py:224\u001b[0m, in \u001b[0;36mCachedAccessor.__get__\u001b[1;34m(self, obj, cls)\u001b[0m\n\u001b[0;32m    221\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m obj \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m    222\u001b[0m     \u001b[38;5;66;03m# we're accessing the attribute of the class, i.e., Dataset.geo\u001b[39;00m\n\u001b[0;32m    223\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_accessor\n\u001b[1;32m--> 224\u001b[0m accessor_obj \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    225\u001b[0m \u001b[38;5;66;03m# Replace the property with the accessor object. Inspired by:\u001b[39;00m\n\u001b[0;32m    226\u001b[0m \u001b[38;5;66;03m# https://www.pydanny.com/cached-property.html\u001b[39;00m\n\u001b[0;32m    227\u001b[0m \u001b[38;5;66;03m# We need to use object.__setattr__ because we overwrite __setattr__ on\u001b[39;00m\n\u001b[0;32m    228\u001b[0m \u001b[38;5;66;03m# NDFrame\u001b[39;00m\n\u001b[0;32m    229\u001b[0m \u001b[38;5;28mobject\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__setattr__\u001b[39m(obj, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_name, accessor_obj)\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\indexes\\accessors.py:643\u001b[0m, in \u001b[0;36mCombinedDatetimelikeProperties.__new__\u001b[1;34m(cls, data)\u001b[0m\n\u001b[0;32m    640\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data\u001b[38;5;241m.\u001b[39mdtype, PeriodDtype):\n\u001b[0;32m    641\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m PeriodProperties(data, orig)\n\u001b[1;32m--> 643\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mAttributeError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCan only use .dt accessor with datetimelike values\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
      "\u001b[1;31mAttributeError\u001b[0m: Can only use .dt accessor with datetimelike values"
     ]
    }
   ],
   "source": [
    "t['ErledigungsDatum'].dt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "9ad24677-b0be-4f4e-9067-b4746e0ba039",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "Can only use .dt accessor with datetimelike values",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[38], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mt\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mErstellungsDatum\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdt\u001b[49m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\generic.py:6299\u001b[0m, in \u001b[0;36mNDFrame.__getattr__\u001b[1;34m(self, name)\u001b[0m\n\u001b[0;32m   6292\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[0;32m   6293\u001b[0m     name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_internal_names_set\n\u001b[0;32m   6294\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_metadata\n\u001b[0;32m   6295\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_accessors\n\u001b[0;32m   6296\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_info_axis\u001b[38;5;241m.\u001b[39m_can_hold_identifiers_and_holds_name(name)\n\u001b[0;32m   6297\u001b[0m ):\n\u001b[0;32m   6298\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m[name]\n\u001b[1;32m-> 6299\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mobject\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__getattribute__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\accessor.py:224\u001b[0m, in \u001b[0;36mCachedAccessor.__get__\u001b[1;34m(self, obj, cls)\u001b[0m\n\u001b[0;32m    221\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m obj \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m    222\u001b[0m     \u001b[38;5;66;03m# we're accessing the attribute of the class, i.e., Dataset.geo\u001b[39;00m\n\u001b[0;32m    223\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_accessor\n\u001b[1;32m--> 224\u001b[0m accessor_obj \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_accessor\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    225\u001b[0m \u001b[38;5;66;03m# Replace the property with the accessor object. Inspired by:\u001b[39;00m\n\u001b[0;32m    226\u001b[0m \u001b[38;5;66;03m# https://www.pydanny.com/cached-property.html\u001b[39;00m\n\u001b[0;32m    227\u001b[0m \u001b[38;5;66;03m# We need to use object.__setattr__ because we overwrite __setattr__ on\u001b[39;00m\n\u001b[0;32m    228\u001b[0m \u001b[38;5;66;03m# NDFrame\u001b[39;00m\n\u001b[0;32m    229\u001b[0m \u001b[38;5;28mobject\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__setattr__\u001b[39m(obj, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_name, accessor_obj)\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\indexes\\accessors.py:643\u001b[0m, in \u001b[0;36mCombinedDatetimelikeProperties.__new__\u001b[1;34m(cls, data)\u001b[0m\n\u001b[0;32m    640\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data\u001b[38;5;241m.\u001b[39mdtype, PeriodDtype):\n\u001b[0;32m    641\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m PeriodProperties(data, orig)\n\u001b[1;32m--> 643\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mAttributeError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCan only use .dt accessor with datetimelike values\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
      "\u001b[1;31mAttributeError\u001b[0m: Can only use .dt accessor with datetimelike values"
     ]
    }
   ],
   "source": [
    "t['ErstellungsDatum'].dt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "de697da1-2a4d-465f-988e-5d0a68840167",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "unsupported operand type(s) for -: 'str' and 'str'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\ops\\array_ops.py:218\u001b[0m, in \u001b[0;36m_na_arithmetic_op\u001b[1;34m(left, right, op, is_cmp)\u001b[0m\n\u001b[0;32m    217\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 218\u001b[0m     result \u001b[38;5;241m=\u001b[39m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mleft\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mright\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    219\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\computation\\expressions.py:242\u001b[0m, in \u001b[0;36mevaluate\u001b[1;34m(op, a, b, use_numexpr)\u001b[0m\n\u001b[0;32m    240\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m use_numexpr:\n\u001b[0;32m    241\u001b[0m         \u001b[38;5;66;03m# error: \"None\" not callable\u001b[39;00m\n\u001b[1;32m--> 242\u001b[0m         \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_evaluate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mop_str\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43ma\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mb\u001b[49m\u001b[43m)\u001b[49m  \u001b[38;5;66;03m# type: ignore[misc]\u001b[39;00m\n\u001b[0;32m    243\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _evaluate_standard(op, op_str, a, b)\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\computation\\expressions.py:73\u001b[0m, in \u001b[0;36m_evaluate_standard\u001b[1;34m(op, op_str, a, b)\u001b[0m\n\u001b[0;32m     72\u001b[0m     _store_test_result(\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[1;32m---> 73\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mop\u001b[49m\u001b[43m(\u001b[49m\u001b[43ma\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mb\u001b[49m\u001b[43m)\u001b[49m\n",
      "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for -: 'str' and 'str'",
      "\nDuring handling of the above exception, another exception occurred:\n",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[36], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m t[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtest\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[43mt\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mErledigungsDatum\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mt\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mErstellungsDatum\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\ops\\common.py:76\u001b[0m, in \u001b[0;36m_unpack_zerodim_and_defer.<locals>.new_method\u001b[1;34m(self, other)\u001b[0m\n\u001b[0;32m     72\u001b[0m             \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mNotImplemented\u001b[39m\n\u001b[0;32m     74\u001b[0m other \u001b[38;5;241m=\u001b[39m item_from_zerodim(other)\n\u001b[1;32m---> 76\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmethod\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mother\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\arraylike.py:194\u001b[0m, in \u001b[0;36mOpsMixin.__sub__\u001b[1;34m(self, other)\u001b[0m\n\u001b[0;32m    192\u001b[0m \u001b[38;5;129m@unpack_zerodim_and_defer\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__sub__\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m    193\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__sub__\u001b[39m(\u001b[38;5;28mself\u001b[39m, other):\n\u001b[1;32m--> 194\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_arith_method\u001b[49m\u001b[43m(\u001b[49m\u001b[43mother\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moperator\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msub\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\series.py:6135\u001b[0m, in \u001b[0;36mSeries._arith_method\u001b[1;34m(self, other, op)\u001b[0m\n\u001b[0;32m   6133\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_arith_method\u001b[39m(\u001b[38;5;28mself\u001b[39m, other, op):\n\u001b[0;32m   6134\u001b[0m     \u001b[38;5;28mself\u001b[39m, other \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_align_for_op(other)\n\u001b[1;32m-> 6135\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mbase\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mIndexOpsMixin\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_arith_method\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mother\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mop\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\base.py:1382\u001b[0m, in \u001b[0;36mIndexOpsMixin._arith_method\u001b[1;34m(self, other, op)\u001b[0m\n\u001b[0;32m   1379\u001b[0m     rvalues \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39marange(rvalues\u001b[38;5;241m.\u001b[39mstart, rvalues\u001b[38;5;241m.\u001b[39mstop, rvalues\u001b[38;5;241m.\u001b[39mstep)\n\u001b[0;32m   1381\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m np\u001b[38;5;241m.\u001b[39merrstate(\u001b[38;5;28mall\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mignore\u001b[39m\u001b[38;5;124m\"\u001b[39m):\n\u001b[1;32m-> 1382\u001b[0m     result \u001b[38;5;241m=\u001b[39m \u001b[43mops\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43marithmetic_op\u001b[49m\u001b[43m(\u001b[49m\u001b[43mlvalues\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrvalues\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mop\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m   1384\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_construct_result(result, name\u001b[38;5;241m=\u001b[39mres_name)\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\ops\\array_ops.py:283\u001b[0m, in \u001b[0;36marithmetic_op\u001b[1;34m(left, right, op)\u001b[0m\n\u001b[0;32m    279\u001b[0m     _bool_arith_check(op, left, right)  \u001b[38;5;66;03m# type: ignore[arg-type]\u001b[39;00m\n\u001b[0;32m    281\u001b[0m     \u001b[38;5;66;03m# error: Argument 1 to \"_na_arithmetic_op\" has incompatible type\u001b[39;00m\n\u001b[0;32m    282\u001b[0m     \u001b[38;5;66;03m# \"Union[ExtensionArray, ndarray[Any, Any]]\"; expected \"ndarray[Any, Any]\"\u001b[39;00m\n\u001b[1;32m--> 283\u001b[0m     res_values \u001b[38;5;241m=\u001b[39m \u001b[43m_na_arithmetic_op\u001b[49m\u001b[43m(\u001b[49m\u001b[43mleft\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mright\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mop\u001b[49m\u001b[43m)\u001b[49m  \u001b[38;5;66;03m# type: ignore[arg-type]\u001b[39;00m\n\u001b[0;32m    285\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m res_values\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\ops\\array_ops.py:227\u001b[0m, in \u001b[0;36m_na_arithmetic_op\u001b[1;34m(left, right, op, is_cmp)\u001b[0m\n\u001b[0;32m    219\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n\u001b[0;32m    220\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_cmp \u001b[38;5;129;01mand\u001b[39;00m (\n\u001b[0;32m    221\u001b[0m         left\u001b[38;5;241m.\u001b[39mdtype \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mobject\u001b[39m \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(right, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m) \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mobject\u001b[39m\n\u001b[0;32m    222\u001b[0m     ):\n\u001b[1;32m   (...)\u001b[0m\n\u001b[0;32m    225\u001b[0m         \u001b[38;5;66;03m# Don't do this for comparisons, as that will handle complex numbers\u001b[39;00m\n\u001b[0;32m    226\u001b[0m         \u001b[38;5;66;03m#  incorrectly, see GH#32047\u001b[39;00m\n\u001b[1;32m--> 227\u001b[0m         result \u001b[38;5;241m=\u001b[39m \u001b[43m_masked_arith_op\u001b[49m\u001b[43m(\u001b[49m\u001b[43mleft\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mright\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mop\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    228\u001b[0m     \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m    229\u001b[0m         \u001b[38;5;28;01mraise\u001b[39;00m\n",
      "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pandas\\core\\ops\\array_ops.py:163\u001b[0m, in \u001b[0;36m_masked_arith_op\u001b[1;34m(x, y, op)\u001b[0m\n\u001b[0;32m    161\u001b[0m     \u001b[38;5;66;03m# See GH#5284, GH#5035, GH#19448 for historical reference\u001b[39;00m\n\u001b[0;32m    162\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m mask\u001b[38;5;241m.\u001b[39many():\n\u001b[1;32m--> 163\u001b[0m         result[mask] \u001b[38;5;241m=\u001b[39m \u001b[43mop\u001b[49m\u001b[43m(\u001b[49m\u001b[43mxrav\u001b[49m\u001b[43m[\u001b[49m\u001b[43mmask\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43myrav\u001b[49m\u001b[43m[\u001b[49m\u001b[43mmask\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    165\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m    166\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m is_scalar(y):\n",
      "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for -: 'str' and 'str'"
     ]
    }
   ],
   "source": [
    "t['test'] = t['ErledigungsDatum'] - t['ErstellungsDatum']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c2b1724e-f48d-41a3-98c6-710bef840ba5",
   "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.11.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
