plesna/notebooks/gold2mart.ipynb

1534 lines
52 KiB
Plaintext
Raw Normal View History

2024-02-17 04:28:42 +00:00
{
"cells": [
{
"cell_type": "markdown",
"id": "46102be7-d318-480c-ad7a-be28ebc7b8d5",
"metadata": {},
"source": [
"# Gold vers DataMart"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "a7ebc69e-a43f-4118-b1e1-104c7794dd6d",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "b148ae5c-0e77-47d1-a7df-bbdc3e8cf5a4",
"metadata": {},
"outputs": [],
"source": [
"gold_path = Path(\"../PLESNA Compta SYSTEM/gold\")\n",
"assert gold_path.exists()\n",
"mart_path = Path(\"../PLESNA Compta SYSTEM/datamart\")\n",
"assert mart_path.exists()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "aa5d5183-b85c-4414-aa2a-50ccc15162ac",
"metadata": {},
"outputs": [],
"source": [
"def to_csv(df, dest):\n",
" if dest.exists():\n",
" df.to_csv(dest, mode=\"a\", header=False, index=False)\n",
" else:\n",
" df.to_csv(dest, index=False)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "82123895-95a4-4bd6-a794-9b891bd38c7b",
"metadata": {},
"outputs": [],
"source": [
"for f in mart_path.glob(\"**/*.csv\"):\n",
" f.unlink()"
]
},
{
"cell_type": "markdown",
"id": "9d0f4705-ae39-4517-b195-82b63f8660b4",
"metadata": {},
"source": [
"## Agrégation de toute la CRG"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c009306d-92d8-42f1-8916-b1d275eae097",
"metadata": {},
"outputs": [],
"source": [
"crg_path = gold_path/\"CRG\"\n",
"assert crg_path.exists()\n",
"crg_files = list(crg_path.glob(\"*.csv\"))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "147c215e-4fb9-4108-9644-bdb5366108df",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"../PLESNA Compta SYSTEM/gold/CRG/2020.csv\n",
"../PLESNA Compta SYSTEM/gold/CRG/2018.csv\n",
"../PLESNA Compta SYSTEM/gold/CRG/2022.csv\n",
"../PLESNA Compta SYSTEM/gold/CRG/2021.csv\n",
"../PLESNA Compta SYSTEM/gold/CRG/2023.csv\n",
"../PLESNA Compta SYSTEM/gold/CRG/2019.csv\n",
"../PLESNA Compta SYSTEM/gold/CRG/2017.csv\n"
]
}
],
"source": [
"dfs = []\n",
"for f in crg_files:\n",
" print(f)\n",
" dfs.append(pd.read_csv(f))\n",
"df_crg = pd.concat(dfs)"
]
},
{
"cell_type": "markdown",
"id": "ace5b951-8a2e-4a32-8d17-ce06ebdab3d4",
"metadata": {},
"source": [
"## Agrégation de toute la banque"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "e43ddf17-578c-46d9-9f8f-14decd2794f9",
"metadata": {},
"outputs": [],
"source": [
"banque_path = gold_path / \"Banque\"\n",
"assert banque_path.exists()\n",
"banque_files = list(banque_path.glob(\"*.csv\"))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "9dbc75a5-6d53-4fd3-81ab-1f3f37342603",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"../PLESNA Compta SYSTEM/gold/Banque/2020.csv\n",
"../PLESNA Compta SYSTEM/gold/Banque/2022.csv\n",
"../PLESNA Compta SYSTEM/gold/Banque/2021.csv\n"
]
}
],
"source": [
"dfs = []\n",
"for f in banque_files:\n",
" print(f)\n",
" dfs.append(pd.read_csv(f))\n",
"df_banque = pd.concat(dfs)"
]
},
{
"cell_type": "markdown",
"id": "8cfae0d0-f437-456d-bbc7-cb4cb596f5e9",
"metadata": {},
"source": [
"## Lots"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "d8483ebe-70e2-4649-a772-2331f36e0af7",
"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>Régie</th>\n",
" <th>Immeuble</th>\n",
" <th>Porte</th>\n",
" <th>Lot</th>\n",
" <th>Année</th>\n",
" <th>Mois</th>\n",
" <th>Catégorie</th>\n",
" <th>Fournisseur</th>\n",
" <th>Libellé</th>\n",
" <th>Débit</th>\n",
" <th>Crédit</th>\n",
" <th>Impact</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Imi Gérance</td>\n",
" <td>B</td>\n",
" <td>9</td>\n",
" <td>B09</td>\n",
" <td>2020</td>\n",
" <td>1</td>\n",
" <td>Loyer Charge</td>\n",
" <td>NaN</td>\n",
" <td>Règl. Loyer 01/2020</td>\n",
" <td>0.0</td>\n",
" <td>100.48</td>\n",
" <td>100.48</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Imi Gérance</td>\n",
" <td>S</td>\n",
" <td>5</td>\n",
" <td>S05</td>\n",
" <td>2020</td>\n",
" <td>1</td>\n",
" <td>Loyer Charge</td>\n",
" <td>NaN</td>\n",
" <td>Règl. Prov. Char 01/2020</td>\n",
" <td>0.0</td>\n",
" <td>191.00</td>\n",
" <td>191.00</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Imi Gérance</td>\n",
" <td>S</td>\n",
" <td>5</td>\n",
" <td>S05</td>\n",
" <td>2020</td>\n",
" <td>1</td>\n",
" <td>Loyer Charge</td>\n",
" <td>NaN</td>\n",
" <td>Règl. Loyer 01/2020</td>\n",
" <td>0.0</td>\n",
" <td>745.39</td>\n",
" <td>745.39</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Imi Gérance</td>\n",
" <td>S</td>\n",
" <td>2</td>\n",
" <td>S02</td>\n",
" <td>2020</td>\n",
" <td>1</td>\n",
" <td>Loyer Charge</td>\n",
" <td>NaN</td>\n",
" <td>Règl. Prov. Char 01/2020</td>\n",
" <td>0.0</td>\n",
" <td>519.00</td>\n",
" <td>519.00</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Imi Gérance</td>\n",
" <td>S</td>\n",
" <td>2</td>\n",
" <td>S02</td>\n",
" <td>2020</td>\n",
" <td>1</td>\n",
" <td>Loyer Charge</td>\n",
" <td>NaN</td>\n",
" <td>Règl. Loyer 01 à 03/2020</td>\n",
" <td>0.0</td>\n",
" <td>3473.79</td>\n",
" <td>3473.79</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Régie Immeuble Porte Lot Année Mois Catégorie Fournisseur \\\n",
"0 Imi Gérance B 9 B09 2020 1 Loyer Charge NaN \n",
"1 Imi Gérance S 5 S05 2020 1 Loyer Charge NaN \n",
"2 Imi Gérance S 5 S05 2020 1 Loyer Charge NaN \n",
"3 Imi Gérance S 2 S02 2020 1 Loyer Charge NaN \n",
"4 Imi Gérance S 2 S02 2020 1 Loyer Charge NaN \n",
"\n",
" Libellé Débit Crédit Impact \n",
"0 Règl. Loyer 01/2020 0.0 100.48 100.48 \n",
"1 Règl. Prov. Char 01/2020 0.0 191.00 191.00 \n",
"2 Règl. Loyer 01/2020 0.0 745.39 745.39 \n",
"3 Règl. Prov. Char 01/2020 0.0 519.00 519.00 \n",
"4 Règl. Loyer 01 à 03/2020 0.0 3473.79 3473.79 "
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_crg.head()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "4fcc7d32-1923-4fcb-a411-6d72ac33843b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"../PLESNA Compta SYSTEM/datamart/Lot/B09.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S05.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S02.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S10.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M05.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B07.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B14.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B10.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B02.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M04.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S04.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S11.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S20.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S13.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S18.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S06.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S09.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S16.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S12.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S07.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S15.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S19.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S17.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S14.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B15.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M13.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B17.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B01.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B05.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B11.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M08.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M07.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B06.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M06.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M12.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B03.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M10.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B13.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B08.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M02.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M09.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M11.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B16.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B12.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B18.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B19.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B04.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S03.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S08.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/B20.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/SPC.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/MPC.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/BPC.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/S01.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M01.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/Bnan.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/Snan.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/BMnan.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/MPC .csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/Mnan.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/M03.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/Scontentieux.csv\n",
"../PLESNA Compta SYSTEM/datamart/Lot/0nan.csv\n"
]
}
],
"source": [
"lot_path = mart_path / \"Lot\"\n",
"lot_path.mkdir(exist_ok=True)\n",
"for lot in df_crg[\"Lot\"].unique():\n",
" df = df_crg[df_crg[\"Lot\"] == lot]\n",
" dest = lot_path/f\"{lot}.csv\"\n",
" print(dest)\n",
" to_csv(df, dest)"
]
},
{
"cell_type": "markdown",
"id": "4d874024-37d3-4ad2-88a0-8ab8d7e50ea3",
"metadata": {},
"source": [
"## PnL"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "ac663ab4-53cc-4574-a3a2-624703cb66b5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{2017, 2018, 2019, 2020, 2021, 2022}"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"years = set(list(df_crg[\"Année\"].unique()) + list(df_banque[\"Année\"]))\n",
"years"
]
},
{
"cell_type": "code",
"execution_count": 48,
"id": "b688bfe3-3901-45c8-b9cf-22db69068716",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2017\n",
"../PLESNA Compta SYSTEM/datamart/PnL/2017.csv\n",
"2018\n",
"../PLESNA Compta SYSTEM/datamart/PnL/2018.csv\n",
"2019\n",
"../PLESNA Compta SYSTEM/datamart/PnL/2019.csv\n",
"2020\n",
"../PLESNA Compta SYSTEM/datamart/PnL/2020.csv\n",
"2021\n",
"../PLESNA Compta SYSTEM/datamart/PnL/2021.csv\n",
"2022\n",
"../PLESNA Compta SYSTEM/datamart/PnL/2022.csv\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_187410/3027169384.py:14: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.\n",
" df = pd.concat([df_crg, df_bq])\n",
"/tmp/ipykernel_187410/3027169384.py:14: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.\n",
" df = pd.concat([df_crg, df_bq])\n",
"/tmp/ipykernel_187410/3027169384.py:14: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.\n",
" df = pd.concat([df_crg, df_bq])\n"
]
}
],
"source": [
"cols = [\"Catégorie\", \"Mois\", \"Impact\"]\n",
"pnl_path = mart_path / \"PnL\"\n",
"pnl_path.mkdir(exist_ok=True)\n",
"for year in years:\n",
" print(year)\n",
" try:\n",
" df_crg = pd.read_csv(crg_path/f\"{year}.csv\")[cols]\n",
" except FileNotFoundError:\n",
" df_crg = pd.DataFrame(columns=cols)\n",
" try:\n",
" df_bq = pd.read_csv(banque_path/f\"{year}.csv\")[cols]\n",
" except FileNotFoundError:\n",
" df_bq = pd.DataFrame(columns=cols)\n",
" df = pd.concat([df_crg, df_bq])\n",
" #pt = pd.pivot_table(df, index=\"Catégorie\", columns=\"Mois\", aggfunc=\"sum\").fillna(0)\n",
" pt = df.groupby([\"Catégorie\", \"Mois\"]).agg(\"sum\").unstack().fillna(0)\n",
" pt.columns = [c[1] for c in pt.columns]\n",
" pt.reset_index([\"Catégorie\"])\n",
" dest = pnl_path / f\"{year}.csv\" \n",
" print(dest)\n",
" pt.to_csv(dest)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "b5ea06ef-b2d8-4706-8187-50c1f220a424",
"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>Catégorie</th>\n",
" <th>Mois</th>\n",
" <th>Impact</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Hono E/S</td>\n",
" <td>1</td>\n",
" <td>-80.00</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Hono E/S</td>\n",
" <td>1</td>\n",
" <td>-270.24</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Hono E/S</td>\n",
" <td>1</td>\n",
" <td>-900.08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Hono E/S</td>\n",
" <td>1</td>\n",
" <td>-80.00</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Hono E/S</td>\n",
" <td>1</td>\n",
" <td>-145.50</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Catégorie Mois Impact\n",
"0 Hono E/S 1 -80.00\n",
"1 Hono E/S 1 -270.24\n",
"2 Hono E/S 1 -900.08\n",
"3 Hono E/S 1 -80.00\n",
"4 Hono E/S 1 -145.50"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "7ba9caa0-8b6a-4d21-a155-c73f6535ff21",
"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 tr th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe thead tr:last-of-type th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr>\n",
" <th></th>\n",
" <th colspan=\"12\" halign=\"left\">Impact</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Mois</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" <th>4</th>\n",
" <th>5</th>\n",
" <th>6</th>\n",
" <th>7</th>\n",
" <th>8</th>\n",
" <th>9</th>\n",
" <th>10</th>\n",
" <th>11</th>\n",
" <th>12</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Catégorie</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Archi</th>\n",
" <td>-3600.00</td>\n",
" <td>-2160.00</td>\n",
" <td>-2880.00</td>\n",
" <td>-480.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ascenseur</th>\n",
" <td>-1723.96</td>\n",
" <td>-114.74</td>\n",
" <td>-1651.72</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Assurance</th>\n",
" <td>-6624.06</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>CCA</th>\n",
" <td>0.00</td>\n",
" <td>2622912.98</td>\n",
" <td>-2780000.00</td>\n",
" <td>-100000.0</td>\n",
" <td>-20000.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Comptable</th>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>-1320.00</td>\n",
" <td>-1200.0</td>\n",
" <td>0.00</td>\n",
" <td>-1320.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>-1320.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>-1320.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Diagnotics</th>\n",
" <td>0.00</td>\n",
" <td>-672.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Eau</th>\n",
" <td>0.00</td>\n",
" <td>-50.52</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Elec</th>\n",
" <td>-273.74</td>\n",
" <td>-316.06</td>\n",
" <td>-845.50</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Entretien</th>\n",
" <td>-3184.22</td>\n",
" <td>-5196.08</td>\n",
" <td>-4516.42</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Frais Bancaire</th>\n",
" <td>-33.36</td>\n",
" <td>-33.36</td>\n",
" <td>-33.36</td>\n",
" <td>-35.8</td>\n",
" <td>-33.36</td>\n",
" <td>-38.24</td>\n",
" <td>-35.80</td>\n",
" <td>-50.04</td>\n",
" <td>0.00</td>\n",
" <td>-35.80</td>\n",
" <td>-35.80</td>\n",
" <td>-35.8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Frais Financier</th>\n",
" <td>-2500.00</td>\n",
" <td>-2338.06</td>\n",
" <td>-14500.00</td>\n",
" <td>-2500.0</td>\n",
" <td>-2500.00</td>\n",
" <td>-14593.38</td>\n",
" <td>-2500.00</td>\n",
" <td>-2500.00</td>\n",
" <td>-14500.00</td>\n",
" <td>-2500.00</td>\n",
" <td>-2500.00</td>\n",
" <td>-24044.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Gerant</th>\n",
" <td>0.00</td>\n",
" <td>-2000.00</td>\n",
" <td>-6000.00</td>\n",
" <td>2000.0</td>\n",
" <td>-4000.00</td>\n",
" <td>-2000.00</td>\n",
" <td>0.00</td>\n",
" <td>-4000.00</td>\n",
" <td>-2000.00</td>\n",
" <td>-2000.00</td>\n",
" <td>-2000.00</td>\n",
" <td>-2000.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Hono E/S</th>\n",
" <td>-4023.24</td>\n",
" <td>-1299.60</td>\n",
" <td>-2574.20</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Hono Gestion</th>\n",
" <td>-4874.42</td>\n",
" <td>-4742.62</td>\n",
" <td>-7188.70</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Loyer Charge</th>\n",
" <td>78140.44</td>\n",
" <td>72844.08</td>\n",
" <td>72592.78</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Revenue Gérance</th>\n",
" <td>52453.04</td>\n",
" <td>23182.84</td>\n",
" <td>8758.64</td>\n",
" <td>0.0</td>\n",
" <td>107455.38</td>\n",
" <td>53207.64</td>\n",
" <td>68744.94</td>\n",
" <td>25165.24</td>\n",
" <td>110581.24</td>\n",
" <td>82715.02</td>\n",
" <td>56121.26</td>\n",
" <td>106563.7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Solde Comptable</th>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>-136367.42</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>TF</th>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.0</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-2258.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Travaux</th>\n",
" <td>-4983.76</td>\n",
" <td>-37674.84</td>\n",
" <td>-58680.84</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Xfert Tréso</th>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Impact \\\n",
"Mois 1 2 3 4 5 \n",
"Catégorie \n",
"Archi -3600.00 -2160.00 -2880.00 -480.0 0.00 \n",
"Ascenseur -1723.96 -114.74 -1651.72 0.0 0.00 \n",
"Assurance -6624.06 0.00 0.00 0.0 0.00 \n",
"CCA 0.00 2622912.98 -2780000.00 -100000.0 -20000.00 \n",
"Comptable 0.00 0.00 -1320.00 -1200.0 0.00 \n",
"Diagnotics 0.00 -672.00 0.00 0.0 0.00 \n",
"Eau 0.00 -50.52 0.00 0.0 0.00 \n",
"Elec -273.74 -316.06 -845.50 0.0 0.00 \n",
"Entretien -3184.22 -5196.08 -4516.42 0.0 0.00 \n",
"Frais Bancaire -33.36 -33.36 -33.36 -35.8 -33.36 \n",
"Frais Financier -2500.00 -2338.06 -14500.00 -2500.0 -2500.00 \n",
"Gerant 0.00 -2000.00 -6000.00 2000.0 -4000.00 \n",
"Hono E/S -4023.24 -1299.60 -2574.20 0.0 0.00 \n",
"Hono Gestion -4874.42 -4742.62 -7188.70 0.0 0.00 \n",
"Loyer Charge 78140.44 72844.08 72592.78 0.0 0.00 \n",
"Revenue Gérance 52453.04 23182.84 8758.64 0.0 107455.38 \n",
"Solde Comptable 0.00 0.00 -136367.42 0.0 0.00 \n",
"TF -7436.00 -7436.00 -7436.00 -7436.0 -7436.00 \n",
"Travaux -4983.76 -37674.84 -58680.84 0.0 0.00 \n",
"Xfert Tréso 0.00 0.00 0.00 0.0 0.00 \n",
"\n",
" \\\n",
"Mois 6 7 8 9 10 11 \n",
"Catégorie \n",
"Archi 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Ascenseur 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Assurance 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"CCA 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Comptable -1320.00 0.00 0.00 -1320.00 0.00 0.00 \n",
"Diagnotics 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Eau 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Elec 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Entretien 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Frais Bancaire -38.24 -35.80 -50.04 0.00 -35.80 -35.80 \n",
"Frais Financier -14593.38 -2500.00 -2500.00 -14500.00 -2500.00 -2500.00 \n",
"Gerant -2000.00 0.00 -4000.00 -2000.00 -2000.00 -2000.00 \n",
"Hono E/S 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Hono Gestion 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Loyer Charge 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Revenue Gérance 53207.64 68744.94 25165.24 110581.24 82715.02 56121.26 \n",
"Solde Comptable 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"TF -7436.00 -7436.00 -7436.00 -7436.00 -7436.00 -2258.00 \n",
"Travaux 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"Xfert Tréso 0.00 0.00 0.00 0.00 0.00 0.00 \n",
"\n",
" \n",
"Mois 12 \n",
"Catégorie \n",
"Archi 0.0 \n",
"Ascenseur 0.0 \n",
"Assurance 0.0 \n",
"CCA 0.0 \n",
"Comptable -1320.0 \n",
"Diagnotics 0.0 \n",
"Eau 0.0 \n",
"Elec 0.0 \n",
"Entretien 0.0 \n",
"Frais Bancaire -35.8 \n",
"Frais Financier -24044.0 \n",
"Gerant -2000.0 \n",
"Hono E/S 0.0 \n",
"Hono Gestion 0.0 \n",
"Loyer Charge 0.0 \n",
"Revenue Gérance 106563.7 \n",
"Solde Comptable 0.0 \n",
"TF 0.0 \n",
"Travaux 0.0 \n",
"Xfert Tréso 0.0 "
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pt = pd.pivot_table(df, index=\"Catégorie\", columns=\"Mois\", aggfunc=\"sum\").fillna(0)\n",
"pt"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "5e3d01a2-93d4-4b5e-84df-3e3cfda5eabd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"MultiIndex([('Impact', 1),\n",
" ('Impact', 2),\n",
" ('Impact', 3),\n",
" ('Impact', 4),\n",
" ('Impact', 5),\n",
" ('Impact', 6),\n",
" ('Impact', 7),\n",
" ('Impact', 8),\n",
" ('Impact', 9),\n",
" ('Impact', 10),\n",
" ('Impact', 11),\n",
" ('Impact', 12)],\n",
" names=[None, 'Mois'])"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pt = df.groupby([\"Catégorie\", \"Mois\"]).agg(\"sum\").unstack().fillna(0)\n",
"pt.columns"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "48720528-7d29-432e-9019-cb1b11c6e399",
"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>Catégorie</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" <th>4</th>\n",
" <th>5</th>\n",
" <th>6</th>\n",
" <th>7</th>\n",
" <th>8</th>\n",
" <th>9</th>\n",
" <th>10</th>\n",
" <th>11</th>\n",
" <th>12</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Archi</td>\n",
" <td>-3600.00</td>\n",
" <td>-2160.00</td>\n",
" <td>-2880.00</td>\n",
" <td>-480.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Ascenseur</td>\n",
" <td>-1723.96</td>\n",
" <td>-114.74</td>\n",
" <td>-1651.72</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Assurance</td>\n",
" <td>-6624.06</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>CCA</td>\n",
" <td>0.00</td>\n",
" <td>2622912.98</td>\n",
" <td>-2780000.00</td>\n",
" <td>-100000.0</td>\n",
" <td>-20000.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Comptable</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>-1320.00</td>\n",
" <td>-1200.0</td>\n",
" <td>0.00</td>\n",
" <td>-1320.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>-1320.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>-1320.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Diagnotics</td>\n",
" <td>0.00</td>\n",
" <td>-672.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Eau</td>\n",
" <td>0.00</td>\n",
" <td>-50.52</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Elec</td>\n",
" <td>-273.74</td>\n",
" <td>-316.06</td>\n",
" <td>-845.50</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Entretien</td>\n",
" <td>-3184.22</td>\n",
" <td>-5196.08</td>\n",
" <td>-4516.42</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Frais Bancaire</td>\n",
" <td>-33.36</td>\n",
" <td>-33.36</td>\n",
" <td>-33.36</td>\n",
" <td>-35.8</td>\n",
" <td>-33.36</td>\n",
" <td>-38.24</td>\n",
" <td>-35.80</td>\n",
" <td>-50.04</td>\n",
" <td>0.00</td>\n",
" <td>-35.80</td>\n",
" <td>-35.80</td>\n",
" <td>-35.8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>Frais Financier</td>\n",
" <td>-2500.00</td>\n",
" <td>-2338.06</td>\n",
" <td>-14500.00</td>\n",
" <td>-2500.0</td>\n",
" <td>-2500.00</td>\n",
" <td>-14593.38</td>\n",
" <td>-2500.00</td>\n",
" <td>-2500.00</td>\n",
" <td>-14500.00</td>\n",
" <td>-2500.00</td>\n",
" <td>-2500.00</td>\n",
" <td>-24044.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>Gerant</td>\n",
" <td>0.00</td>\n",
" <td>-2000.00</td>\n",
" <td>-6000.00</td>\n",
" <td>2000.0</td>\n",
" <td>-4000.00</td>\n",
" <td>-2000.00</td>\n",
" <td>0.00</td>\n",
" <td>-4000.00</td>\n",
" <td>-2000.00</td>\n",
" <td>-2000.00</td>\n",
" <td>-2000.00</td>\n",
" <td>-2000.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>Hono E/S</td>\n",
" <td>-4023.24</td>\n",
" <td>-1299.60</td>\n",
" <td>-2574.20</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>Hono Gestion</td>\n",
" <td>-4874.42</td>\n",
" <td>-4742.62</td>\n",
" <td>-7188.70</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>Loyer Charge</td>\n",
" <td>78140.44</td>\n",
" <td>72844.08</td>\n",
" <td>72592.78</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>Revenue Gérance</td>\n",
" <td>52453.04</td>\n",
" <td>23182.84</td>\n",
" <td>8758.64</td>\n",
" <td>0.0</td>\n",
" <td>107455.38</td>\n",
" <td>53207.64</td>\n",
" <td>68744.94</td>\n",
" <td>25165.24</td>\n",
" <td>110581.24</td>\n",
" <td>82715.02</td>\n",
" <td>56121.26</td>\n",
" <td>106563.7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>Solde Comptable</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>-136367.42</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>TF</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.0</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-7436.00</td>\n",
" <td>-2258.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>Travaux</td>\n",
" <td>-4983.76</td>\n",
" <td>-37674.84</td>\n",
" <td>-58680.84</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>Xfert Tréso</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.00</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Catégorie 1 2 3 4 5 \\\n",
"0 Archi -3600.00 -2160.00 -2880.00 -480.0 0.00 \n",
"1 Ascenseur -1723.96 -114.74 -1651.72 0.0 0.00 \n",
"2 Assurance -6624.06 0.00 0.00 0.0 0.00 \n",
"3 CCA 0.00 2622912.98 -2780000.00 -100000.0 -20000.00 \n",
"4 Comptable 0.00 0.00 -1320.00 -1200.0 0.00 \n",
"5 Diagnotics 0.00 -672.00 0.00 0.0 0.00 \n",
"6 Eau 0.00 -50.52 0.00 0.0 0.00 \n",
"7 Elec -273.74 -316.06 -845.50 0.0 0.00 \n",
"8 Entretien -3184.22 -5196.08 -4516.42 0.0 0.00 \n",
"9 Frais Bancaire -33.36 -33.36 -33.36 -35.8 -33.36 \n",
"10 Frais Financier -2500.00 -2338.06 -14500.00 -2500.0 -2500.00 \n",
"11 Gerant 0.00 -2000.00 -6000.00 2000.0 -4000.00 \n",
"12 Hono E/S -4023.24 -1299.60 -2574.20 0.0 0.00 \n",
"13 Hono Gestion -4874.42 -4742.62 -7188.70 0.0 0.00 \n",
"14 Loyer Charge 78140.44 72844.08 72592.78 0.0 0.00 \n",
"15 Revenue Gérance 52453.04 23182.84 8758.64 0.0 107455.38 \n",
"16 Solde Comptable 0.00 0.00 -136367.42 0.0 0.00 \n",
"17 TF -7436.00 -7436.00 -7436.00 -7436.0 -7436.00 \n",
"18 Travaux -4983.76 -37674.84 -58680.84 0.0 0.00 \n",
"19 Xfert Tréso 0.00 0.00 0.00 0.0 0.00 \n",
"\n",
" 6 7 8 9 10 11 12 \n",
"0 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"1 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"2 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"3 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"4 -1320.00 0.00 0.00 -1320.00 0.00 0.00 -1320.0 \n",
"5 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"6 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"7 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"8 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"9 -38.24 -35.80 -50.04 0.00 -35.80 -35.80 -35.8 \n",
"10 -14593.38 -2500.00 -2500.00 -14500.00 -2500.00 -2500.00 -24044.0 \n",
"11 -2000.00 0.00 -4000.00 -2000.00 -2000.00 -2000.00 -2000.0 \n",
"12 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"13 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"14 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"15 53207.64 68744.94 25165.24 110581.24 82715.02 56121.26 106563.7 \n",
"16 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"17 -7436.00 -7436.00 -7436.00 -7436.00 -7436.00 -2258.00 0.0 \n",
"18 0.00 0.00 0.00 0.00 0.00 0.00 0.0 \n",
"19 0.00 0.00 0.00 0.00 0.00 0.00 0.0 "
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pt.columns = [c[1] for c in pt.columns]\n",
"pt.reset_index([\"Catégorie\"])"
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "43202565-7645-445e-b7be-750c1c16d7ab",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['Archi', 'Ascenseur', 'Assurance', 'CCA', 'Comptable', 'Diagnotics',\n",
" 'Eau', 'Elec', 'Entretien', 'Frais Bancaire', 'Frais Financier',\n",
" 'Gerant', 'Hono E/S', 'Hono Gestion', 'Loyer Charge', 'Revenue Gérance',\n",
" 'Solde Comptable', 'TF', 'Travaux', 'Xfert Tréso'],\n",
" dtype='object', name='Catégorie')"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pt.index"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3cc60d28-d4ef-416b-a2a4-ecdc472f411c",
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}