{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "f512fba3-877f-411e-935c-0c878d478b2d", "metadata": { "scrolled": true }, "outputs": [], "source": [ "#alle Seeding logs\n", "import neofarm.lib as neo\n", "\n", "#plant = neo.Asset.Plant.from_id(\"76f89f82-1238-43bb-b34f-796a92d491a2\")\n", "#print(plant.name)\n", "\n", "\n", "seedings = neo.Log.Seeding.get_list()\n", "for seeding in seedings:\n", " plant = seeding.plant\n", " equipment = seeding.equipment[0]\n", " quantity1 = seeding.quantities[0]\n", " quantity2 = seeding.quantities[1]\n", " print(f\"name: {seeding.name}\")\n", " print(f\"timestamp: {seeding.timestamp}\")\n", " print(f\"plant name: {plant.name}\")\n", " print(f\"plant crop: {plant.crop[0].name}\")\n", " print(f\"plant loc: {plant.location[0].name}\")\n", " print(f\"equipment: {equipment.name}\")\n", " print(f\"isMovement: {seeding.isMovement}\")\n", " print(f\"Q1 type: {quantity1.type}\")\n", " print(f\"Q1 measure: {quantity1.measure}\")\n", " print(f\"Q1 value: {quantity1.value}\")\n", " print(f\"Q1 units: {quantity1.units.name}\")\n", " print(f\"Q1 inv adj: {quantity1.inventory_adjustment}\")\n", " print(f\"Q1 inv ass: {quantity1.inventory_asset.name}\")\n", " print(f\"Q2 type: {quantity2.type}\")\n", " print(f\"Q2 measure: {quantity2.measure}\")\n", " print(f\"Q2 value: {quantity2.value}\")\n", " print(f\"Q2 units: {quantity2.units.name}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "c1bf2175-65f7-4704-8d39-15a08849c9ae", "metadata": { "jupyter": { "source_hidden": true } }, "outputs": [], "source": [ "import neofarm.lib as neo\n", "\n", "#plant = neo.Asset.Plant.from_id(\"76f89f82-1238-43bb-b34f-796a92d491a2\")\n", "#print(plant.name)\n", "\n", "\n", "seedings = neo.Log.Purchase.get_list()\n", "for seeding in seedings:\n", " plant = seeding.plant\n", " #equipment = seeding.equipment[0]\n", " quantity1 = seeding.quantities[0]\n", " # quantity2 = seeding.quantities[1]\n", " print(f\"name: {seeding.name}\")\n", " print(f\"timestamp: {seeding.timestamp}\")\n", " #print(f\"plant name: {plant.name}\")\n", " #print(f\"plant crop: {plant.crop[0].name}\")\n", " #print(f\"plant loc: {plant.location[0].name}\")\n", " #print(f\"equipment: {equipment.name}\")\n", " print(f\"isMovement: {seeding.isMovement}\")\n", " print(f\"Q1 type: {quantity1.type}\")\n", " print(f\"Q1 measure: {quantity1.measure}\")\n", " print(f\"Q1 value: {quantity1.value}\")\n", " print(f\"Q1 units: {quantity1.units.name}\")\n", " print(f\"Q1 inv adj: {quantity1.inventory_adjustment}\")\n", " print(f\"Q1 inv ass: {quantity1.inventory_asset.name}\")\n", " print(f\"Q2 type: {quantity2.type}\")\n", " print(f\"Q2 measure: {quantity2.measure}\")\n", " print(f\"Q2 value: {quantity2.value}\")\n", " print(f\"Q2 units: {quantity2.units.name}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "fdf49f3b-3949-4895-97fb-f5bd2484fce3", "metadata": { "jupyter": { "source_hidden": true } }, "outputs": [], "source": [ "import neofarm.lib as neo\n", "\n", "inputs = neo.Input.get_list()\n", "for element in inputs:\n", " #equipment = element.equipment[0]\n", " print(f\"name: {element.name}\")\n", " print(f\"timestamp: {element.timestamp}\")\n", " print(f\"plant name: {element.plant.name}\")\n", " print(f\"plant crop: {element.plant.crop[0].name}\")\n", " print(f\"plant loc: {element.plant.location[0].name}\")\n", " print(f\"equipment: {element.equipment[0].name}\")\n", " print(f\"isMovement: {element.isMovement}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "28598d92-24f2-47cb-bb19-9943800eefe1", "metadata": {}, "outputs": [], "source": [ "import neofarm.lib as neo\n", "\n", "data = neo.Log.Harvest.get_list()\n", "for element in data:\n", " #equipment = element.equipment[0]\n", " print(f\"name: {element.name}\")\n", " print(f\"timestamp: {element.timestamp}\")\n", " print(f\"plant name: {element.plant.name}\")\n", " print(f\"plant crop: {element.plant.crop[0].name}\")\n", " print(f\"plant loc: {element.plant.location[0].name}\")\n", " print(f\"equipment: {element.equipment[0].name}\")\n", " print(f\"isMovement: {element.isMovement}\")\n", " print(f\"Name vom Inventory asset von der Quantity: {element.quantities[0].inventory_asset.name}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "a993570d-dea2-4bd6-80c0-b36297ce6a3a", "metadata": { "jupyter": { "source_hidden": true } }, "outputs": [], "source": [ "#Beispiel\n", "import neofarm.lib as neo\n", "\n", "if __name__ == \"__main__\":\n", " asset = neo.Asset.Plant.from_id(\"76f89f82-1238-43bb-b34f-796a92d491a2\")\n", " logs = asset.get_logs_of_type(neo.Log.Activity)\n", " for log in logs:\n", " print(log.name)" ] }, { "cell_type": "code", "execution_count": null, "id": "3a33ffb1-afe7-44b5-863b-9779a95a2a9c", "metadata": {}, "outputs": [], "source": [ "# alle logs von einem Plant \n", "import neofarm.lib as neo\n", "from datetime import datetime\n", "\n", "if __name__ == \"__main__\":\n", " asset = neo.Asset.Plant.from_id(\"76f89f82-1238-43bb-b34f-796a92d491a2\")\n", "\n", "#Plantname\n", " PlantName = \"W-Raps Helmacker Plant 24/25\" \n", " print(f\"PlantName: {PlantName}\")\n", "\n", " \n", "#log Maintenance\n", " logs = asset.get_logs_of_type(neo.Log.Maintenance)\n", " for log in logs:\n", " print(\"Maintenance:\")\n", " print(f\"name: {log.name}\")\n", " formatted_date = datetime.fromisoformat(log.timestamp).strftime(\"%d.%m.%y %H:%M \") # Konvertiere in das gewünschte Format\n", " print(f\"timestamp: {formatted_date}\") \n", " print(f\"equipment: {log.equipment[0].name}\")\n", "#quantity\n", " input=neo.Log.Maintenance.from_id(log.id)\n", " print(f\"quant_type: {input.quantities[0].type}\")\n", " print(f\"quant_measure: {input.quantities[0].measure}\")\n", " print(f\"quant_value: {input.quantities[0].value}\")\n", " print(f\"quant_inventory_adjustment: {input.quantities[0].inventory_adjustment}\")\n", " print(f\"quant_value: {input.quantities[0].value}\")\n", " print(f\"unit_name: {input.quantities[0].units.name}\")\n", " \n", " \t\n", "#log Seeding \n", " logs = asset.get_logs_of_type(neo.Log.Seeding)\n", " for log in logs:\n", " print(\"Seeding:\")\n", " print(f\"name: {log.name}\")\n", " formatted_date = datetime.fromisoformat(log.timestamp).strftime(\"%d.%m.%y %H:%M \") # Konvertiere in das gewünschte Format\n", " print(f\"timestamp: {formatted_date}\")\n", " print(f\"equipment: {log.equipment[0].name}\")\n", " print(f\"plant loc: {log.location[0].name}\")\n", "#quantity\n", " input=neo.Log.Seeding.from_id(log.id)\n", " print(f\"quant_type: {input.quantities[0].type}\")\n", " print(f\"quant_measure: {input.quantities[0].measure}\")\n", " print(f\"quant_value: {input.quantities[0].value}\")\n", " print(f\"quant_inventory_adjustment: {input.quantities[0].inventory_adjustment}\")\n", " print(f\"quant_inventory_name: {input.quantities[0].inventory_asset.name}\")\n", "\n", "#log Input \n", " logs = asset.get_logs_of_type(neo.Log.Input)\n", " for log in logs:\n", " print(\"Input:\")\n", " print(f\"name: {log.name}\")\n", " #print(f\"name: {log.id}\")\n", " formatted_date = datetime.fromisoformat(log.timestamp).strftime(\"%d.%m.%y %H:%M \") # Konvertiere in das gewünschte Format\n", " print(f\"timestamp: {formatted_date}\")\n", " print(f\"equipment: {log.equipment[0].name}\")\n", "\n", "#quantity\n", " input=neo.Log.Input.from_id(log.id)\n", " print(f\"quant_type: {input.quantities[0].type}\")\n", " print(f\"quant_measure: {input.quantities[0].measure}\")\n", " print(f\"quant_value: {input.quantities[0].value}\")\n", " print(f\"quant_inventory_adjustment: {input.quantities[0].inventory_adjustment}\")\n", "\n", "#log Medical\n", " logs = asset.get_logs_of_type(neo.Log.Medical)\n", " for log in logs:\n", " print(\"Medical:\")\n", " print(f\"name: {log.name}\")\n", " formatted_date = datetime.fromisoformat(log.timestamp).strftime(\"%d.%m.%y %H:%M \") # Konvertiere in das gewünschte Format\n", " print(f\"timestamp: {formatted_date}\")\n", " print(f\"equipment: {log.equipment[0].name}\")\n", "\n", "#quantity\n", " input=neo.Log.Medical.from_id(log.id)\n", " print(f\"quant_type: {input.quantities[0].type}\")\n", " print(f\"quant_measure: {input.quantities[0].measure}\")\n", " print(f\"quant_value: {input.quantities[0].value}\")\n", " print(f\"quant_inventory_adjustment: {input.quantities[0].inventory_adjustment}\")\n", "\n", "\n", "#log Harvest \n", " logs = asset.get_logs_of_type(neo.Log.Harvest)\n", " for log in logs:\n", " print(\"Harvest:\")\n", " print(f\"name: {log.name}\")\n", " formatted_date = datetime.fromisoformat(log.timestamp).strftime(\"%d.%m.%y %H:%M \") # Konvertiere in das gewünschte Format\n", " print(f\"timestamp: {formatted_date}\")\n", " print(f\"equipment: {log.equipment[0].name}\")\n", "\n", "#quantity\n", " input=neo.Log.Harvest.from_id(log.id)\n", " print(f\"quant_type: {input.quantities[0].type}\")\n", " print(f\"quant_measure: {input.quantities[0].measure}\")\n", " print(f\"quant_value: {input.quantities[0].value}\")\n", " print(f\"quant_inventory_adjustment: {input.quantities[0].inventory_adjustment}\")\n", "\n", "#log Sale \n", " logs = asset.get_logs_of_type(neo.Log.Sale)\n", " for log in logs:\n", " print(\"Sale:\")\n", " print(f\"name: {log.name}\")\n", " formatted_date = datetime.fromisoformat(log.timestamp).strftime(\"%d.%m.%y %H:%M \") # Konvertiere in das gewünschte Format\n", " print(f\"timestamp: {formatted_date}\")\n", "\n", "#quantity\n", " input=neo.Log.Sale.from_id(log.id)\n", " print(f\"quant_type: {input.quantities[0].type}\")\n", " print(f\"quant_measure: {input.quantities[0].measure}\")\n", " print(f\"quant_value: {input.quantities[0].value}\")\n", " print(f\"quant_inventory_adjustment: {input.quantities[0].inventory_adjustment}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "de57b155-d635-4367-9a56-90d033c3a922", "metadata": { "jupyter": { "source_hidden": true } }, "outputs": [], "source": [ "#Alle logs zu plant mit quantities untereinander tabelle\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "if __name__ == \"__main__\":\n", " asset = neo.Asset.Plant.from_id(\"76f89f82-1238-43bb-b34f-796a92d491a2\")\n", "\n", " # Definiere den Pflanzennamen\n", " PlantName = \"W-Raps Helmacker Plant 24/25\"\n", " print(f\"PlantName: {PlantName}\")\n", "\n", " # Erstelle eine Liste zur Sammlung der Daten\n", " data = []\n", "\n", " # Funktion, um Logs zu verarbeiten und die Daten zur Liste hinzuzufügen\n", " def process_logs(logs, log_type):\n", " for log in logs:\n", " formatted_date = datetime.fromisoformat(log.timestamp).strftime(\"%d.%m.%Y\")\n", " equipment_name = log.equipment[0].name if log.equipment else \"None\"\n", " location_name = log.location[0].name if hasattr(log, 'location') and log.location else \"None\"\n", "\n", " # Menge und weitere Details (falls vorhanden)\n", " quantities = getattr(log, 'quantities', [])\n", " for quantity in quantities:\n", " data.append({\n", " \"PlantName\": PlantName,\n", " \"LogType\": log_type,\n", " \"Name\": log.name,\n", " \"Timestamp\": formatted_date,\n", " \"Equipment\": equipment_name,\n", " \"Location\": location_name,\n", " \"QuantType\": quantity.type,\n", " \"QuantMeasure\": quantity.measure,\n", " \"QuantValue\": quantity.value,\n", " \"UnitName\": quantities[0].units.name,\n", " \"QuantInventoryAdjustment\": quantity.inventory_adjustment\n", " \n", " })\n", " # Falls keine Mengeninformationen vorhanden sind\n", " if not quantities:\n", " data.append({\n", " \"PlantName\": PlantName,\n", " \"LogType\": log_type,\n", " \"Name\": log.name,\n", " \"Timestamp\": formatted_date,\n", " \"Equipment\": equipment_name,\n", " \"Location\": location_name,\n", " \"QuantType\": \"\",\n", " \"QuantMeasure\": \"\",\n", " \"QuantValue\": \"\",\n", " \"UnitName\": quantities[0].units.name,\n", " \"QuantInventoryAdjustment\": \"\"\n", " \n", " })\n", "\n", " # Verarbeite die verschiedenen Log-Typen\n", " process_logs(asset.get_logs_of_type(neo.Log.Maintenance), \"Maintenance\")\n", " process_logs(asset.get_logs_of_type(neo.Log.Seeding), \"Seeding\")\n", " process_logs(asset.get_logs_of_type(neo.Log.Input), \"Input\")\n", " process_logs(asset.get_logs_of_type(neo.Log.Medical), \"Medical\")\n", " process_logs(asset.get_logs_of_type(neo.Log.Harvest), \"Harvest\")\n", " process_logs(asset.get_logs_of_type(neo.Log.Sale), \"Sale\")\n", "\n", " # Erstelle ein DataFrame aus den gesammelten Daten und zeige es an\n", " df = pd.DataFrame(data)\n", " display(df)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "3e3fe365-b32b-4210-847c-bea0b36bd34c", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "946b0281-c77a-4a1e-8e91-5f06ba74afa5", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "d6d12b59-4895-426e-9a30-c9cee801671e", "metadata": { "scrolled": true }, "outputs": [], "source": [ "#Master Report\n", "# Importieren der benötigten Bibliotheken\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "def process_logs(asset_id, plant_name):\n", " \"\"\"\n", " Diese Funktion ruft alle Log-Daten für eine bestimmte Pflanzen-ID ab,\n", " formatiert sie und organisiert sie in einer Liste von Dictionarys.\n", " Schließlich gibt sie einen DataFrame zurück, der die aggregierten Log-Daten enthält.\n", " \n", " Parameter:\n", " asset_id (str): Die ID der Pflanze, für die die Logs abgerufen werden sollen.\n", " plant_name (str): Der Name der Pflanze.\n", "\n", " Rückgabe:\n", " pd.DataFrame: Ein DataFrame mit allen gesammelten Log-Daten zur angegebenen Pflanze.\n", " \"\"\"\n", " # Lade die Pflanze basierend auf ihrer ID\n", " asset = neo.Asset.Plant.from_id(asset_id)\n", " data = [] # Liste zum Sammeln der Log-Daten\n", " \n", " # Definieren der Log-Typen, die abgefragt werden sollen\n", " log_types = [\n", " (\"Maintenance\", neo.Log.Maintenance),\n", " (\"Seeding\", neo.Log.Seeding),\n", " (\"Input\", neo.Log.Input),\n", " (\"Medical\", neo.Log.Medical),\n", " (\"Harvest\", neo.Log.Harvest),\n", " (\"Sale\", neo.Log.Sale),\n", " ]\n", " \n", " # Durchlaufen jeder Log-Typ-Kombination und Abrufen der zugehörigen Log-Daten\n", " for log_name, log_type in log_types:\n", " logs = asset.get_logs_of_type(log_type)\n", " \n", " # Verarbeitung der einzelnen Logs für den aktuellen Log-Typ\n", " for log in logs:\n", " # Formatieren des Timestamps im deutschen Datumsformat\n", " formatted_date = datetime.fromisoformat(log.timestamp).strftime(\"%d.%m.%Y\")\n", " \n", " # Abrufen des ersten Equipment-Namens oder Standardwert, falls nicht vorhanden\n", " equipment_name = log.equipment[0].name if log.equipment else \"None\"\n", "\n", " \n", " # Abrufen des ersten Location-Namens oder leer, falls nicht vorhanden\n", " location_name = log.location[0].name if hasattr(log, 'location') and log.location else \"\"\n", "\n", " # Abrufen des ersten inventory_asset-Namens oder leer, falls nicht vorhanden\n", " inventory_asset_name = log.inventory_asset.name if hasattr(log, 'inventory_asset') and log.inventory_asset else \"\"\n", "\n", " \n", " # Abrufen aller Mengen (quantities) im Log\n", " quantities = getattr(log, 'quantities', [])\n", " \n", " # Initialisieren von Platzhaltern für den Fall, dass weniger als zwei Mengen vorhanden sind\n", " quant_type_2 = quant_measure_2 = quant_value_2 = quant_inventory_adjustment_2 = \"\"\n", " quant_unit_name_1 = quant_unit_name_2 = \"\"\n", "\n", " # Verarbeitung der ersten Menge, falls vorhanden\n", " if len(quantities) > 0:\n", " quant_type_1 = quantities[0].type\n", " quant_measure_1 = quantities[0].measure\n", " quant_value_1 = quantities[0].value\n", " #quant_unit_price_1 = quantities[0].unit_price \n", " #quant_total_price = quantities[0].total_price\n", " quant_inventory_adjustment_1 = quantities[0].inventory_adjustment\n", " # quant_inventory_name_1 = quantities[0].inventory_asset\n", " quant_unit_name_1 = quantities[0].units.name if quantities[0].units else \"\"\n", " quant_inventory_name_1 = quantities[0].inventory_asset.name if quantities[0].inventory_asset else \"\"\n", " \n", " else:\n", " # Leere Werte, falls keine Menge vorhanden ist\n", " quant_type_1 = quant_measure_1 = quant_value_1 = quant_inventory_adjustment_1 = \"\"\n", "\n", " # Verarbeitung der zweiten Menge, falls vorhanden\n", " if len(quantities) > 1:\n", " quant_type_2 = quantities[1].type\n", " quant_measure_2 = quantities[1].measure\n", " quant_value_2 = quantities[1].value\n", " quant_inventory_adjustment_2 = quantities[1].inventory_adjustment\n", " quant_unit_name_2 = quantities[1].units.name if quantities[1].units else \"\"\n", "\n", " # Hinzufügen der gesammelten Daten für diesen Log als Dictionary in die Liste\n", " data.append({\n", " \"PlantName\": plant_name,\n", " \"LogType\": log_name,\n", " \"Name\": log.name,\n", " \"Timestamp\": formatted_date,\n", " \"Equipment\": equipment_name,\n", " \"Location\": location_name,\n", " \"QuantType_1\": quant_type_1,\n", " \"QuantMeasure_1\": quant_measure_1,\n", " \"QuantValue_1\": quant_value_1,\n", " \"QuantUnitName1\": quant_unit_name_1,\n", " \"QuantInventoryAdjustment_1\": quant_inventory_adjustment_1,\n", " \"quant_inventory_name_1\": quant_inventory_name_1,\n", " \"QuantType_2\": quant_type_2,\n", " \"QuantMeasure_2\": quant_measure_2,\n", " \"QuantValue_2\": quant_value_2,\n", " \"QuantUnitName2\": quant_unit_name_2,\n", " \"QuantInventoryAdjustment_2\": quant_inventory_adjustment_2\n", " })\n", " \n", " # Rückgabe des DataFrames mit allen gesammelten Log-Daten\n", " return pd.DataFrame(data)\n", "\n", "# Beispielaufruf zur Demonstration\n", "if __name__ == \"__main__\":\n", " # ID und Name der Pflanze definieren\n", " asset_id = \"76f89f82-1238-43bb-b34f-796a92d491a2\"\n", " plant_name = \"W-Raps Helmacker Plant 24/25\"\n", " \n", " # Abrufen und Formatieren der Logs in einem DataFrame\n", " df = process_logs(asset_id, plant_name)\n", " \n", " # Konvertieren des 'Timestamp' in ein Datum für die korrekte Anzeige und Berechnung\n", " df['Timestamp'] = pd.to_datetime(df['Timestamp'], format=\"%d.%m.%Y\")\n", " \n", " # Anzeigen des DataFrames zur Veranschaulichung\n", " display(df)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "172b3075-7435-40e1-bbb5-138e1ca48800", "metadata": { "jupyter": { "source_hidden": true } }, "outputs": [], "source": [ "#ExcelExport\n", "import pandas as pd\n", "import os\n", "from openpyxl import load_workbook\n", "from openpyxl.utils import get_column_letter\n", "from openpyxl.styles import Alignment\n", "\n", "def export_to_excel(df, file_path, date_column=\"D\"):\n", " # Exportiere den DataFrame zu Excel\n", " df.to_excel(file_path, index=False)\n", " \n", " # Lade die Arbeitsmappe, um Formatierungen hinzuzufügen\n", " workbook = load_workbook(file_path)\n", " worksheet = workbook.active\n", " worksheet.auto_filter.ref = worksheet.dimensions\n", "\n", " # Passen Sie die Spaltenbreite an und aktivieren Sie den Zeilenumbruch\n", " for col in worksheet.columns:\n", " max_length = 0\n", " col_letter = get_column_letter(col[0].column)\n", " for cell in col:\n", " cell.alignment = Alignment(wrap_text=True)\n", " \n", " # Setze das Datumsformat für die angegebene Spalte\n", " if col_letter == date_column:\n", " cell.number_format = 'DD.MM.YYYY'\n", " \n", " max_length = max(max_length, len(str(cell.value)) if cell.value else 0)\n", " \n", " adjusted_width = (max_length + 2) * 1.0\n", " worksheet.column_dimensions[col_letter].width = adjusted_width\n", "\n", " workbook.save(file_path)\n", " print(f\"Die Datei wurde erfolgreich nach '{file_path}' exportiert, mit Autofilter, Zeilenumbruch und angepasster Spaltenbreite.\")\n", "\n", "# Beispielaufruf\n", "if __name__ == \"__main__\":\n", " downloads_folder = os.path.join(os.path.expanduser(\"~\"), \"Downloads\")\n", " file_path = os.path.join(downloads_folder, \"PlantLogs.xlsx\")\n", " \n", " \n", " # Prüfe, ob die Datei bereits existiert\n", " if os.path.exists(file_path):\n", " overwrite = input(f\"Die Datei '{file_path}' existiert bereits. Möchten Sie sie überschreiben? (ja/nein): \")\n", " if overwrite.lower() == 'ja':\n", " export_to_excel(df, file_path)\n", " else:\n", " print(\"Der Export wurde abgebrochen.\")\n", " else:\n", " export_to_excel(df, file_path)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "fc1f2524-ca06-426f-a402-9e61ec9ddfbe", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 7, "id": "849c4af5-f0f9-47f4-b841-fa8dc3e27c15", "metadata": { "collapsed": true, "jupyter": { "outputs_hidden": true, "source_hidden": true }, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
nametimestampplant_nameplant_cropplant_locationequipmentisMovementQ1_typeQ1_measureQ1_valueQ1_unitsQ1_inventory_adjustmentQ1_inventory_assetQ2_typeQ2_measureQ2_valueQ2_units
0W-Raps Otello KWS Helmacker Seeding 24/2522.08.2024W-Raps Helmacker Plant 24/25RapsHelmackerSähmaschine CatayaFalsequantity--standardweight50kgdecrementW-Raps Saatgut Otello KWS Seed 08/24quantity--standardarea3.02ha
1W-Raps Otello KWS Nachtweide Seeding 24/2528.08.2024W-Raps Nachtweide Plant 24/25RapsNachtweideSähmaschine CatayaFalsequantity--standardweight66kgdecrementW-Raps Saatgut Otello KWS Seed 08/24quantity--standardarea4.5ha
\n", "
" ], "text/plain": [ " name timestamp \\\n", "0 W-Raps Otello KWS Helmacker Seeding 24/25 22.08.2024 \n", "1 W-Raps Otello KWS Nachtweide Seeding 24/25 28.08.2024 \n", "\n", " plant_name plant_crop plant_location \\\n", "0 W-Raps Helmacker Plant 24/25 Raps Helmacker \n", "1 W-Raps Nachtweide Plant 24/25 Raps Nachtweide \n", "\n", " equipment isMovement Q1_type Q1_measure Q1_value \\\n", "0 Sähmaschine Cataya False quantity--standard weight 50 \n", "1 Sähmaschine Cataya False quantity--standard weight 66 \n", "\n", " Q1_units Q1_inventory_adjustment Q1_inventory_asset \\\n", "0 kg decrement W-Raps Saatgut Otello KWS Seed 08/24 \n", "1 kg decrement W-Raps Saatgut Otello KWS Seed 08/24 \n", "\n", " Q2_type Q2_measure Q2_value Q2_units \n", "0 quantity--standard area 3.02 ha \n", "1 quantity--standard area 4.5 ha " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Alle Seeding Logs\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "# Liste für die Sammlung der Seeding-Log-Daten\n", "data = []\n", "\n", "# Alle Seeding-Logs abrufen\n", "seedings = neo.Log.Seeding.get_list()\n", "for seeding in seedings:\n", " plant = seeding.plant\n", " equipment = seeding.equipment[0]\n", " quantity1 = seeding.quantities[0]\n", " quantity2 = seeding.quantities[1]\n", " \n", " # Seeding-Daten als Dictionary hinzufügen\n", " data.append({\n", " \"name\": seeding.name,\n", " \"timestamp\": datetime.fromisoformat(seeding.timestamp).strftime(\"%d.%m.%Y\"), # Konvertiere in das gewünschte Format\n", " \"plant_name\": plant.name,\n", " \"plant_crop\": plant.crop[0].name,\n", " \"plant_location\": plant.location[0].name,\n", " \"equipment\": equipment.name,\n", " \"isMovement\": seeding.isMovement,\n", " \"Q1_type\": quantity1.type,\n", " \"Q1_measure\": quantity1.measure,\n", " \"Q1_value\": quantity1.value,\n", " \"Q1_units\": quantity1.units.name,\n", " \"Q1_inventory_adjustment\": quantity1.inventory_adjustment,\n", " \"Q1_inventory_asset\": quantity1.inventory_asset.name,\n", " \"Q2_type\": quantity2.type,\n", " \"Q2_measure\": quantity2.measure,\n", " \"Q2_value\": quantity2.value,\n", " \"Q2_units\": quantity2.units.name\n", " })\n", "\n", "# DataFrame erstellen und anzeigen\n", "df = pd.DataFrame(data)\n", "df\n" ] }, { "cell_type": "code", "execution_count": 9, "id": "27e54d8e-cda2-465c-88eb-963a0fff3c5d", "metadata": { "collapsed": true, "jupyter": { "outputs_hidden": true } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
nametimestampplant_nameequipmentQ1_typeQ1_measureQ1_valueQ1_unitsQ1_inventory_adjustment
0Scheibeneggen Helmacker Maintenance 24/2528.07.2024W-Raps Helmacker Plant 24/25Scheibenegge Catrosquantity--pricetime2hNone
\n", "
" ], "text/plain": [ " name timestamp \\\n", "0 Scheibeneggen Helmacker Maintenance 24/25 28.07.2024 \n", "\n", " plant_name equipment Q1_type \\\n", "0 W-Raps Helmacker Plant 24/25 Scheibenegge Catros quantity--price \n", "\n", " Q1_measure Q1_value Q1_units Q1_inventory_adjustment \n", "0 time 2 h None " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Alle Maintenance Logs\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "# Liste für die Sammlung der Mainenance-Log-Daten\n", "data = []\n", "\n", "# Alle Maintenance-Logs abrufen\n", "maintenances = neo.Log.Maintenance.get_list()\n", "for maintenance in maintenances:\n", " plant = maintenance.plant\n", " equipment = maintenance.equipment[0]\n", " quantity1 = maintenance.quantities[0]\n", " \n", " \n", " # Maintenance-Daten als Dictionary hinzufügen\n", " data.append({\n", " \"name\": maintenance.name,\n", " \"timestamp\": datetime.fromisoformat(maintenance.timestamp).strftime(\"%d.%m.%Y\"), # Konvertiere in das gewünschte Format\n", " \"plant_name\": plant.name,\n", " \"equipment\": equipment.name,\n", " \"Q1_type\": quantity1.type,\n", " \"Q1_measure\": quantity1.measure,\n", " \"Q1_value\": quantity1.value,\n", " \"Q1_units\": quantity1.units.name,\n", " \"Q1_inventory_adjustment\": quantity1.inventory_adjustment,\n", "\n", "\n", " })\n", "\n", "# DataFrame erstellen und anzeigen\n", "df = pd.DataFrame(data)\n", "df\n" ] }, { "cell_type": "code", "execution_count": 13, "id": "e8e0222a-25c8-4f3f-a1e8-5e7753432c4b", "metadata": { "jupyter": { "source_hidden": true }, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
nametimestampplant_nameplant_cropplant_locationequipmentisMovementQ1_typeQ1_measureQ1_valueQ1_unitsQ1_inventory_adjustmentQ1_inventory_asset
0Innovert Raps Input 24/2512.10.2024W-Raps Helmacker Plant 24/25RapsHelmackerSpritzeFalsequantity--standardvolume10ldecrementInnovert Raps Material 08/24
1Innovert Raps Input 24/2503.11.2024W-Raps Helmacker Plant 24/25RapsHelmackerSpritzeFalsequantity--standardvolume10ldecrementInnovert Raps Material 08/24
\n", "
" ], "text/plain": [ " name timestamp plant_name \\\n", "0 Innovert Raps Input 24/25 12.10.2024 W-Raps Helmacker Plant 24/25 \n", "1 Innovert Raps Input 24/25 03.11.2024 W-Raps Helmacker Plant 24/25 \n", "\n", " plant_crop plant_location equipment isMovement Q1_type \\\n", "0 Raps Helmacker Spritze False quantity--standard \n", "1 Raps Helmacker Spritze False quantity--standard \n", "\n", " Q1_measure Q1_value Q1_units Q1_inventory_adjustment \\\n", "0 volume 10 l decrement \n", "1 volume 10 l decrement \n", "\n", " Q1_inventory_asset \n", "0 Innovert Raps Material 08/24 \n", "1 Innovert Raps Material 08/24 " ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Alle Input Logs\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "# Liste für die Sammlung der Input-Log-Daten\n", "data = []\n", "\n", "# Alle Input-Logs abrufen\n", "inputs = neo.Log.Input.get_list()\n", "for input in inputs:\n", " plant = input.plant\n", " equipment = input.equipment[0]\n", " quantity1 = input.quantities[0]\n", "\n", " \n", " # Input-Daten als Dictionary hinzufügen\n", " data.append({\n", " \"name\": input.name,\n", " \"timestamp\": datetime.fromisoformat(input.timestamp).strftime(\"%d.%m.%Y\"), # Konvertiere in das gewünschte Format\n", " \"plant_name\": plant.name,\n", " \"plant_crop\": plant.crop[0].name,\n", " \"plant_location\": plant.location[0].name,\n", " \"equipment\": equipment.name,\n", " \"isMovement\": input.isMovement,\n", " \"Q1_type\": quantity1.type,\n", " \"Q1_measure\": quantity1.measure,\n", " \"Q1_value\": quantity1.value,\n", " \"Q1_units\": quantity1.units.name,\n", " \"Q1_inventory_adjustment\": quantity1.inventory_adjustment,\n", " \"Q1_inventory_asset\": quantity1.inventory_asset.name,\n", "\n", " })\n", "\n", "# DataFrame erstellen und anzeigen\n", "df = pd.DataFrame(data)\n", "df\n" ] }, { "cell_type": "code", "execution_count": null, "id": "318b15bd-4ea4-4eb6-b434-00900f1528dc", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 14, "id": "6356e491-8615-40eb-ad75-a21cb517afc2", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
nametimestampplant_nameplant_cropplant_locationequipmentisMovementQ1_typeQ1_measureQ1_valueQ1_unitsQ1_inventory_adjustmentQ1_inventory_asset
0Schneckenkorn Medical 24/2530.08.2024W-Raps Helmacker Plant 24/25RapsHelmackerSchneckenkornstreuer LeinfelderFalsequantity--standardweight10kgdecrementSchneckenkorn Material 08/24
\n", "
" ], "text/plain": [ " name timestamp plant_name \\\n", "0 Schneckenkorn Medical 24/25 30.08.2024 W-Raps Helmacker Plant 24/25 \n", "\n", " plant_crop plant_location equipment isMovement \\\n", "0 Raps Helmacker Schneckenkornstreuer Leinfelder False \n", "\n", " Q1_type Q1_measure Q1_value Q1_units Q1_inventory_adjustment \\\n", "0 quantity--standard weight 10 kg decrement \n", "\n", " Q1_inventory_asset \n", "0 Schneckenkorn Material 08/24 " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Alle Medical Logs\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "# Liste für die Sammlung der Medical-Log-Daten\n", "data = []\n", "\n", "# Alle Medical-Logs abrufen\n", "medicals = neo.Log.Medical.get_list()\n", "for medical in medicals:\n", " plant = medical.plant\n", " equipment = medical.equipment[0]\n", " quantity1 = medical.quantities[0]\n", "\n", " \n", " # Medical-Daten als Dictionary hinzufügen\n", " data.append({\n", " \"name\": medical.name,\n", " \"timestamp\": datetime.fromisoformat(medical.timestamp).strftime(\"%d.%m.%Y\"), # Konvertiere in das gewünschte Format\n", " \"plant_name\": plant.name,\n", " \"plant_crop\": plant.crop[0].name,\n", " \"plant_location\": plant.location[0].name,\n", " \"equipment\": equipment.name,\n", " \"isMovement\": medical.isMovement,\n", " \"Q1_type\": quantity1.type,\n", " \"Q1_measure\": quantity1.measure,\n", " \"Q1_value\": quantity1.value,\n", " \"Q1_units\": quantity1.units.name,\n", " \"Q1_inventory_adjustment\": quantity1.inventory_adjustment,\n", " \"Q1_inventory_asset\": quantity1.inventory_asset.name,\n", "\n", " })\n", "\n", "# DataFrame erstellen und anzeigen\n", "df = pd.DataFrame(data)\n", "df\n" ] }, { "cell_type": "code", "execution_count": 15, "id": "ee597e4c-7275-4cda-8cc6-2daf82dbd4d8", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
nametimestampplant_nameplant_cropplant_locationequipmentisMovementQ1_typeQ1_measureQ1_valueQ1_unitsQ1_inventory_adjustmentQ1_inventory_asset
0W-Raps Helmacker Harvest 24/2520.10.2024W-Raps Helmacker Plant 24/25RapsHelmackerMähdrescher LeinfelderFalsequantity--standardweight5toincrementW-Raps Product 08/24
1W-Raps Nachtweide Harvest 24/2528.10.2024W-Raps Nachtweide Plant 24/25RapsNachtweideMähdrescher LeinfelderFalsequantity--standardweight7.8toincrementW-Raps Product 08/24
\n", "
" ], "text/plain": [ " name timestamp \\\n", "0 W-Raps Helmacker Harvest 24/25 20.10.2024 \n", "1 W-Raps Nachtweide Harvest 24/25 28.10.2024 \n", "\n", " plant_name plant_crop plant_location \\\n", "0 W-Raps Helmacker Plant 24/25 Raps Helmacker \n", "1 W-Raps Nachtweide Plant 24/25 Raps Nachtweide \n", "\n", " equipment isMovement Q1_type Q1_measure Q1_value \\\n", "0 Mähdrescher Leinfelder False quantity--standard weight 5 \n", "1 Mähdrescher Leinfelder False quantity--standard weight 7.8 \n", "\n", " Q1_units Q1_inventory_adjustment Q1_inventory_asset \n", "0 to increment W-Raps Product 08/24 \n", "1 to increment W-Raps Product 08/24 " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Alle Harvest Logs\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "# Liste für die Sammlung der Harvest-Log-Daten\n", "data = []\n", "\n", "# Alle Harvest-Logs abrufen\n", "harvests = neo.Log.Harvest.get_list()\n", "for harvest in harvests:\n", " plant = harvest.plant\n", " equipment = harvest.equipment[0]\n", " quantity1 = harvest.quantities[0]\n", "\n", " \n", " # Harvest-Daten als Dictionary hinzufügen\n", " data.append({\n", " \"name\": harvest.name,\n", " \"timestamp\": datetime.fromisoformat(harvest.timestamp).strftime(\"%d.%m.%Y\"), # Konvertiere in das gewünschte Format\n", " \"plant_name\": plant.name,\n", " \"plant_crop\": plant.crop[0].name,\n", " \"plant_location\": plant.location[0].name,\n", " \"equipment\": equipment.name,\n", " \"isMovement\": harvest.isMovement,\n", " \"Q1_type\": quantity1.type,\n", " \"Q1_measure\": quantity1.measure,\n", " \"Q1_value\": quantity1.value,\n", " \"Q1_units\": quantity1.units.name,\n", " \"Q1_inventory_adjustment\": quantity1.inventory_adjustment,\n", " \"Q1_inventory_asset\": quantity1.inventory_asset.name,\n", "\n", " })\n", "\n", "# DataFrame erstellen und anzeigen\n", "df = pd.DataFrame(data)\n", "df\n" ] }, { "cell_type": "code", "execution_count": 17, "id": "3279d05b-5bae-497e-891d-3337844904f7", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
nametimestampplant_nameplant_cropplant_locationequipmentisMovementQ1_typeQ1_measureQ1_valueQ1_unitsQ1_inventory_adjustmentQ1_inventory_asset
0W-Raps Sale 24/2528.10.2024W-Raps Helmacker Plant 24/25RapsHelmackerMähdrescher LeinfelderFalsequantity--priceweight5todecrementW-Raps Product 08/24
\n", "
" ], "text/plain": [ " name timestamp plant_name plant_crop \\\n", "0 W-Raps Sale 24/25 28.10.2024 W-Raps Helmacker Plant 24/25 Raps \n", "\n", " plant_location equipment isMovement Q1_type \\\n", "0 Helmacker Mähdrescher Leinfelder False quantity--price \n", "\n", " Q1_measure Q1_value Q1_units Q1_inventory_adjustment Q1_inventory_asset \n", "0 weight 5 to decrement W-Raps Product 08/24 " ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Alle Sale Logs\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "# Liste für die Sammlung der Sale-Log-Daten\n", "data = []\n", "\n", "# Alle Sale-Logs abrufen\n", "sales = neo.Log.Sale.get_list()\n", "for sale in sales:\n", " plant = sale.plant\n", " \n", " quantity1 = sale.quantities[0]\n", "\n", " \n", " # Sale-Daten als Dictionary hinzufügen\n", " data.append({\n", " \"name\": sale.name,\n", " \"timestamp\": datetime.fromisoformat(sale.timestamp).strftime(\"%d.%m.%Y\"), # Konvertiere in das gewünschte Format\n", " \"plant_name\": plant.name,\n", " \"plant_crop\": plant.crop[0].name,\n", " \"plant_location\": plant.location[0].name,\n", " \"equipment\": equipment.name,\n", " \"isMovement\": sale.isMovement,\n", " \"Q1_type\": quantity1.type,\n", " \"Q1_measure\": quantity1.measure,\n", " \"Q1_value\": quantity1.value,\n", " \"Q1_units\": quantity1.units.name,\n", " \"Q1_inventory_adjustment\": quantity1.inventory_adjustment,\n", " \"Q1_inventory_asset\": quantity1.inventory_asset.name,\n", "\n", " })\n", "\n", "# DataFrame erstellen und anzeigen\n", "df = pd.DataFrame(data)\n", "df\n" ] }, { "cell_type": "code", "execution_count": 21, "id": "d6be8923-8eb0-4d3b-927a-af15fe2c0ba0", "metadata": { "scrolled": true }, "outputs": [ { "ename": "IndexError", "evalue": "list index out of range", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[21], line 15\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m purchase \u001b[38;5;129;01min\u001b[39;00m purchases:\n\u001b[0;32m 14\u001b[0m quantity1 \u001b[38;5;241m=\u001b[39m purchase\u001b[38;5;241m.\u001b[39mquantities[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m---> 15\u001b[0m quantity2 \u001b[38;5;241m=\u001b[39m \u001b[43mpurchase\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mquantities\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 18\u001b[0m \u001b[38;5;66;03m# Purchase-Daten als Dictionary hinzufügen\u001b[39;00m\n\u001b[0;32m 19\u001b[0m data\u001b[38;5;241m.\u001b[39mappend({\n\u001b[0;32m 20\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m\"\u001b[39m: purchase\u001b[38;5;241m.\u001b[39mname,\n\u001b[0;32m 21\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimestamp\u001b[39m\u001b[38;5;124m\"\u001b[39m: datetime\u001b[38;5;241m.\u001b[39mfromisoformat(purchase\u001b[38;5;241m.\u001b[39mtimestamp)\u001b[38;5;241m.\u001b[39mstrftime(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m%d\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m%\u001b[39m\u001b[38;5;124mm.\u001b[39m\u001b[38;5;124m%\u001b[39m\u001b[38;5;124mY\u001b[39m\u001b[38;5;124m\"\u001b[39m), \u001b[38;5;66;03m# Konvertiere in das gewünschte Format\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 34\u001b[0m \n\u001b[0;32m 35\u001b[0m })\n", "\u001b[1;31mIndexError\u001b[0m: list index out of range" ] } ], "source": [ "#Alle Purchase Logs Baustelle!!\n", "import neofarm.lib as neo\n", "import pandas as pd\n", "from datetime import datetime\n", "\n", "# Liste für die Sammlung der Purchase-Log-Daten\n", "data = []\n", "\n", "# Alle Purchase-Logs abrufen\n", "purchases = neo.Log.Purchase.get_list()\n", "for purchase in purchases:\n", " \n", " \n", " quantity1 = purchase.quantities[0]\n", " quantity2 = purchase.quantities[1]\n", "\n", " \n", " # Purchase-Daten als Dictionary hinzufügen\n", " data.append({\n", " \"name\": purchase.name,\n", " \"timestamp\": datetime.fromisoformat(purchase.timestamp).strftime(\"%d.%m.%Y\"), # Konvertiere in das gewünschte Format\n", " \"Q1_type\": quantity1.type,\n", " \"Q1_measure\": quantity1.measure,\n", " \"Q1_value\": quantity1.value,\n", " \"Q1_units\": quantity1.units.name,\n", " \"Q1_inventory_adjustment\": quantity1.inventory_adjustment,\n", " \"Q1_inventory_asset\": quantity1.inventory_asset.name,\n", " \"Q2_type\": quantity2.type,\n", " \"Q2_measure\": quantity2.measure,\n", " \"Q2_value\": quantity2.value,\n", " \"Q2_units\": quantity2.units.name,\n", " \"Q2_inventory_adjustment\": quantity2.inventory_adjustment,\n", " \"Q2_inventory_asset\": quantity2.inventory_asset.name\n", "\n", " })\n", "\n", "# DataFrame erstellen und anzeigen\n", "df = pd.DataFrame(data)\n", "df\n" ] }, { "cell_type": "code", "execution_count": null, "id": "d63742e3-04a4-4cc0-972f-3edd868325cc", "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.12.5" } }, "nbformat": 4, "nbformat_minor": 5 }