{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"operations = pd.read_csv(\"./00020510001.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"operations[\"Date\"] = pd.to_datetime(operations[\"Date\"])\n",
"operations[\"Date de valeur\"] = pd.to_datetime(operations[\"Date de valeur\"])"
]
},
{
"cell_type": "code",
"execution_count": 129,
"metadata": {},
"outputs": [],
"source": [
"postes = {\n",
" \"autoroute\": [\"AUTOROUTE\", \"APRR\"],\n",
" \"essence\": [\"CARBU\", \"TOTAL\", \"ESSFLO\", \"STATION\", \"AVIA\", ],\n",
" \"bouffe\": [\"BIOCOOP\", \"LA VIE CLAIRE\", \"MAISON VITALE\", \"BOUCHERIE\", \"SALAISON CHALAM\", \"INTERMARCHE\", \"LA FERME DU COIN\",],\n",
" \"bio\": [\"BIOCOOP\", \"LA VIE CLAIRE\", \"MAISON VITALE\"],\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 103,
"metadata": {},
"outputs": [],
"source": [
"def select_mots(df, colname, mots, inverse=False):\n",
" if inverse:\n",
" return df[~df[colname].str.contains('|'.join(mots))]\n",
" return df[df[colname].str.contains('|'.join(mots))]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Mois d'octobre\n",
"\n",
"On est parti en Corse espéront que ça explique tout..."
]
},
{
"cell_type": "code",
"execution_count": 107,
"metadata": {},
"outputs": [],
"source": [
"oct_op = operations[(operations[\"Date\"] >= \"2018-10\") & (operations[\"Date\"] < \"2018-11\")]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Total des dépenses"
]
},
{
"cell_type": "code",
"execution_count": 108,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-1919.1499999999999"
]
},
"execution_count": 108,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"oct_depenses = oct_op[oct_op[\"Montant\"]<0]\n",
"oct_depenses[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Retraits"
]
},
{
"cell_type": "code",
"execution_count": 109,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-360.0"
]
},
"execution_count": 109,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"select_mots(oct_depenses, \"Libellé\", [\"RETRAIT\"])[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Paiement par carte"
]
},
{
"cell_type": "code",
"execution_count": 110,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-1426.02"
]
},
"execution_count": 110,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"select_mots(oct_depenses, \"Libellé\", [\"PAIEMENT\"])[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Dont autoroute"
]
},
{
"cell_type": "code",
"execution_count": 111,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" Date de valeur | \n",
" Montant | \n",
" Libellé | \n",
" Solde | \n",
"
\n",
" \n",
" \n",
" \n",
" 18 | \n",
" 2018-10-12 | \n",
" 2018-10-12 | \n",
" -10.6 | \n",
" PAIEMENT CB 1110 21850 ST APOL APRR CARTE 7414... | \n",
" 221.64 | \n",
"
\n",
" \n",
" 21 | \n",
" 2018-10-15 | \n",
" 2018-10-15 | \n",
" -13.8 | \n",
" PAIEMENT CB 1410 BERSAILLIN APRR CARTE 36045419 | \n",
" 133.29 | \n",
"
\n",
" \n",
" 25 | \n",
" 2018-10-15 | \n",
" 2018-10-15 | \n",
" -2.8 | \n",
" PAIEMENT CB 1410 PARIS RHIN RH APRR CARTE 3604... | \n",
" -80.05 | \n",
"
\n",
" \n",
" 43 | \n",
" 2018-10-22 | \n",
" 2018-10-22 | \n",
" -9.0 | \n",
" PAIEMENT CB 1910 21850 APRR CARTE 36045419 | \n",
" 751.36 | \n",
"
\n",
" \n",
" 44 | \n",
" 2018-10-22 | \n",
" 2018-10-22 | \n",
" -23.8 | \n",
" PAIEMENT CB 2110 VEDENE AUTOROUTE DU SUD CARTE... | \n",
" 727.56 | \n",
"
\n",
" \n",
" 65 | \n",
" 2018-10-31 | \n",
" 2018-10-31 | \n",
" -17.2 | \n",
" PAIEMENT CB 2910 VEDENE AUTOROUTE DU SUD CARTE... | \n",
" 353.13 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date Date de valeur Montant \\\n",
"18 2018-10-12 2018-10-12 -10.6 \n",
"21 2018-10-15 2018-10-15 -13.8 \n",
"25 2018-10-15 2018-10-15 -2.8 \n",
"43 2018-10-22 2018-10-22 -9.0 \n",
"44 2018-10-22 2018-10-22 -23.8 \n",
"65 2018-10-31 2018-10-31 -17.2 \n",
"\n",
" Libellé Solde \n",
"18 PAIEMENT CB 1110 21850 ST APOL APRR CARTE 7414... 221.64 \n",
"21 PAIEMENT CB 1410 BERSAILLIN APRR CARTE 36045419 133.29 \n",
"25 PAIEMENT CB 1410 PARIS RHIN RH APRR CARTE 3604... -80.05 \n",
"43 PAIEMENT CB 1910 21850 APRR CARTE 36045419 751.36 \n",
"44 PAIEMENT CB 2110 VEDENE AUTOROUTE DU SUD CARTE... 727.56 \n",
"65 PAIEMENT CB 2910 VEDENE AUTOROUTE DU SUD CARTE... 353.13 "
]
},
"execution_count": 111,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"select_mots(oct_depenses, \"Libellé\", postes[\"autoroute\"])"
]
},
{
"cell_type": "code",
"execution_count": 112,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-77.2"
]
},
"execution_count": 112,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Dont essence"
]
},
{
"cell_type": "code",
"execution_count": 130,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" Date de valeur | \n",
" Montant | \n",
" Libellé | \n",
" Solde | \n",
"
\n",
" \n",
" \n",
" \n",
" 11 | \n",
" 2018-10-08 | \n",
" 2018-10-08 | \n",
" -56.54 | \n",
" PAIEMENT CB 0610 EPAGNY AUCHAN CARBURANT CARTE... | \n",
" 502.95 | \n",
"
\n",
" \n",
" 17 | \n",
" 2018-10-12 | \n",
" 2018-10-12 | \n",
" -89.62 | \n",
" PAIEMENT CB 1110 ARBENT ESSFLOREALYG341 CARTE ... | \n",
" 232.24 | \n",
"
\n",
" \n",
" 32 | \n",
" 2018-10-18 | \n",
" 2018-10-18 | \n",
" -47.28 | \n",
" PAIEMENT CB 1710 ST CLAUDE STATION TOTAL CARTE... | \n",
" 406.01 | \n",
"
\n",
" \n",
" 37 | \n",
" 2018-10-22 | \n",
" 2018-10-22 | \n",
" -96.43 | \n",
" PAIEMENT CB 1910 ARBENT ESSFLOREALYG341 CARTE ... | \n",
" 866.38 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date Date de valeur Montant \\\n",
"11 2018-10-08 2018-10-08 -56.54 \n",
"17 2018-10-12 2018-10-12 -89.62 \n",
"32 2018-10-18 2018-10-18 -47.28 \n",
"37 2018-10-22 2018-10-22 -96.43 \n",
"\n",
" Libellé Solde \n",
"11 PAIEMENT CB 0610 EPAGNY AUCHAN CARBURANT CARTE... 502.95 \n",
"17 PAIEMENT CB 1110 ARBENT ESSFLOREALYG341 CARTE ... 232.24 \n",
"32 PAIEMENT CB 1710 ST CLAUDE STATION TOTAL CARTE... 406.01 \n",
"37 PAIEMENT CB 1910 ARBENT ESSFLOREALYG341 CARTE ... 866.38 "
]
},
"execution_count": 130,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"select_mots(oct_depenses, \"Libellé\", postes[\"essence\"])"
]
},
{
"cell_type": "code",
"execution_count": 114,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-289.87"
]
},
"execution_count": 114,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Le bio"
]
},
{
"cell_type": "code",
"execution_count": 125,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" Date de valeur | \n",
" Montant | \n",
" Libellé | \n",
" Solde | \n",
"
\n",
" \n",
" \n",
" \n",
" 5 | \n",
" 2018-10-01 | \n",
" 2018-10-01 | \n",
" -10.04 | \n",
" PAIEMENT CB 2809 ST CLAUDE LA VIE CLAIRE CARTE... | \n",
" 362.24 | \n",
"
\n",
" \n",
" 22 | \n",
" 2018-10-15 | \n",
" 2018-10-15 | \n",
" -74.25 | \n",
" PAIEMENT CB 1210 DORLISHEIM LA MAISON VITALE C... | \n",
" 59.04 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date Date de valeur Montant \\\n",
"5 2018-10-01 2018-10-01 -10.04 \n",
"22 2018-10-15 2018-10-15 -74.25 \n",
"\n",
" Libellé Solde \n",
"5 PAIEMENT CB 2809 ST CLAUDE LA VIE CLAIRE CARTE... 362.24 \n",
"22 PAIEMENT CB 1210 DORLISHEIM LA MAISON VITALE C... 59.04 "
]
},
"execution_count": 125,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"select_mots(oct_depenses, \"Libellé\", postes[\"bio\"])"
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-84.28999999999999"
]
},
"execution_count": 126,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Les courses courantes"
]
},
{
"cell_type": "code",
"execution_count": 127,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" Date de valeur | \n",
" Montant | \n",
" Libellé | \n",
" Solde | \n",
"
\n",
" \n",
" \n",
" \n",
" 5 | \n",
" 2018-10-01 | \n",
" 2018-10-01 | \n",
" -10.04 | \n",
" PAIEMENT CB 2809 ST CLAUDE LA VIE CLAIRE CARTE... | \n",
" 362.24 | \n",
"
\n",
" \n",
" 6 | \n",
" 2018-10-01 | \n",
" 2018-10-01 | \n",
" -39.65 | \n",
" PAIEMENT CB 2809 LA PESSE BOUCHERIE GRENA CART... | \n",
" 322.59 | \n",
"
\n",
" \n",
" 12 | \n",
" 2018-10-08 | \n",
" 2018-10-08 | \n",
" -6.90 | \n",
" PAIEMENT CB 0510 LA PESSE SALAISON CHALAM CART... | \n",
" 496.05 | \n",
"
\n",
" \n",
" 16 | \n",
" 2018-10-11 | \n",
" 2018-10-11 | \n",
" -11.69 | \n",
" PAIEMENT CB 0910 LA PESSE BOUCHERIE GRENA CART... | \n",
" 321.86 | \n",
"
\n",
" \n",
" 22 | \n",
" 2018-10-15 | \n",
" 2018-10-15 | \n",
" -74.25 | \n",
" PAIEMENT CB 1210 DORLISHEIM LA MAISON VITALE C... | \n",
" 59.04 | \n",
"
\n",
" \n",
" 31 | \n",
" 2018-10-18 | \n",
" 2018-10-18 | \n",
" -23.06 | \n",
" PAIEMENT CB 1710 ST CLAUDE CED INTERMARCHE CAR... | \n",
" 453.29 | \n",
"
\n",
" \n",
" 40 | \n",
" 2018-10-22 | \n",
" 2018-10-22 | \n",
" -24.72 | \n",
" PAIEMENT CB 1910 CHATUZANGE LE LA FERME DU COI... | \n",
" 833.06 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date Date de valeur Montant \\\n",
"5 2018-10-01 2018-10-01 -10.04 \n",
"6 2018-10-01 2018-10-01 -39.65 \n",
"12 2018-10-08 2018-10-08 -6.90 \n",
"16 2018-10-11 2018-10-11 -11.69 \n",
"22 2018-10-15 2018-10-15 -74.25 \n",
"31 2018-10-18 2018-10-18 -23.06 \n",
"40 2018-10-22 2018-10-22 -24.72 \n",
"\n",
" Libellé Solde \n",
"5 PAIEMENT CB 2809 ST CLAUDE LA VIE CLAIRE CARTE... 362.24 \n",
"6 PAIEMENT CB 2809 LA PESSE BOUCHERIE GRENA CART... 322.59 \n",
"12 PAIEMENT CB 0510 LA PESSE SALAISON CHALAM CART... 496.05 \n",
"16 PAIEMENT CB 0910 LA PESSE BOUCHERIE GRENA CART... 321.86 \n",
"22 PAIEMENT CB 1210 DORLISHEIM LA MAISON VITALE C... 59.04 \n",
"31 PAIEMENT CB 1710 ST CLAUDE CED INTERMARCHE CAR... 453.29 \n",
"40 PAIEMENT CB 1910 CHATUZANGE LE LA FERME DU COI... 833.06 "
]
},
"execution_count": 127,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"select_mots(oct_depenses, \"Libellé\", postes[\"bouffe\"])"
]
},
{
"cell_type": "code",
"execution_count": 128,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-190.31"
]
},
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Autres que les paiements et retraits"
]
},
{
"cell_type": "code",
"execution_count": 115,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" Date de valeur | \n",
" Montant | \n",
" Libellé | \n",
" Solde | \n",
"
\n",
" \n",
" \n",
" \n",
" 7 | \n",
" 2018-10-02 | \n",
" 2018-10-02 | \n",
" -23.10 | \n",
" HABITAT BQ6459900 1827599 BQ6459900 | \n",
" 299.49 | \n",
"
\n",
" \n",
" 9 | \n",
" 2018-10-05 | \n",
" 2018-10-01 | \n",
" -6.25 | \n",
" F FRAIS BANCAIRES MENSUALISES | \n",
" 593.24 | \n",
"
\n",
" \n",
" 26 | \n",
" 2018-10-15 | \n",
" 2018-11-14 | \n",
" -16.00 | \n",
" F COMM INTERVENTION 6 OPER | \n",
" -96.05 | \n",
"
\n",
" \n",
" 29 | \n",
" 2018-10-17 | \n",
" 2018-10-17 | \n",
" -22.00 | \n",
" VIR SEPA JULIE AVELLANA | \n",
" 176.35 | \n",
"
\n",
" \n",
" 58 | \n",
" 2018-10-30 | \n",
" 2018-10-30 | \n",
" -65.78 | \n",
" AUTOMOBILE AA000000020508691 RMS18302072583746HI | \n",
" 680.12 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date Date de valeur Montant \\\n",
"7 2018-10-02 2018-10-02 -23.10 \n",
"9 2018-10-05 2018-10-01 -6.25 \n",
"26 2018-10-15 2018-11-14 -16.00 \n",
"29 2018-10-17 2018-10-17 -22.00 \n",
"58 2018-10-30 2018-10-30 -65.78 \n",
"\n",
" Libellé Solde \n",
"7 HABITAT BQ6459900 1827599 BQ6459900 299.49 \n",
"9 F FRAIS BANCAIRES MENSUALISES 593.24 \n",
"26 F COMM INTERVENTION 6 OPER -96.05 \n",
"29 VIR SEPA JULIE AVELLANA 176.35 \n",
"58 AUTOMOBILE AA000000020508691 RMS18302072583746HI 680.12 "
]
},
"execution_count": 115,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"select_mots(oct_depenses, \"Libellé\", [\"PAIEMENT\", \"RETRAIT\"], inverse=True)"
]
},
{
"cell_type": "code",
"execution_count": 116,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-133.13"
]
},
"execution_count": 116,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Mois de Novembre "
]
},
{
"cell_type": "code",
"execution_count": 117,
"metadata": {},
"outputs": [],
"source": [
"nov_op = operations[(operations[\"Date\"] >= \"2018-11\") & (operations[\"Date\"] < \"2018-12\")]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Total des dépenses"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-1108.68"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nov_depenses = nov_op[nov_op[\"Montant\"]<0]\n",
"nov_depenses[\"Montant\"].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Retraits"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-200.0"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nov_depenses[nov_depenses[\"Libellé\"].str.contains(\"RETRAIT\")]['Montant'].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Paiements directs"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-878.0299999999999"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nov_depenses[nov_depenses[\"Libellé\"].str.contains(\"PAIEMENT\")]['Montant'].sum()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Autres"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Date | \n",
" Date de valeur | \n",
" Montant | \n",
" Libellé | \n",
" Solde | \n",
"
\n",
" \n",
" \n",
" \n",
" 66 | \n",
" 2018-11-01 | \n",
" 2018-11-01 | \n",
" -11.00 | \n",
" VIR SEPA PARTAGE INTERNET | \n",
" 342.13 | \n",
"
\n",
" \n",
" 68 | \n",
" 2018-11-02 | \n",
" 2018-11-02 | \n",
" -13.40 | \n",
" HABITAT BQ6459900 1830699 BQ6459900 | \n",
" 326.83 | \n",
"
\n",
" \n",
" 73 | \n",
" 2018-11-06 | \n",
" 2018-11-01 | \n",
" -6.25 | \n",
" F FRAIS BANCAIRES MENSUALISES | \n",
" 186.38 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Date Date de valeur Montant Libellé \\\n",
"66 2018-11-01 2018-11-01 -11.00 VIR SEPA PARTAGE INTERNET \n",
"68 2018-11-02 2018-11-02 -13.40 HABITAT BQ6459900 1830699 BQ6459900 \n",
"73 2018-11-06 2018-11-01 -6.25 F FRAIS BANCAIRES MENSUALISES \n",
"\n",
" Solde \n",
"66 342.13 \n",
"68 326.83 \n",
"73 186.38 "
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"autres = nov_depenses[~nov_depenses[\"Libellé\"].str.contains(\"PAIEMENT\") & ~nov_depenses[\"Libellé\"].str.contains(\"RETRAIT\")]\n",
"autres"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-30.65"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"autres[\"Montant\"].sum()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}