diff --git a/.quarto/_freeze/economics/index/execute-results/html.json b/.quarto/_freeze/economics/index/execute-results/html.json index d599ba3..d6b9944 100644 --- a/.quarto/_freeze/economics/index/execute-results/html.json +++ b/.quarto/_freeze/economics/index/execute-results/html.json @@ -1,11 +1,15 @@ { - "hash": "72cc8281e14cd0920fdcdb00820092db", + "hash": "f4dd27742fad42be9ff53018c9688622", "result": { - "markdown": "---\ntitle: \"Public civil servant and inflation in France\"\n---\n\nIn the file [fonctionnaires_pauvres.py](fonctionnaires_pauvres.py) we investigated the evolution of the salary of public civil servant in France through the \"Point d'indice\" evolution.\n\n::: {.cell execution_count=1}\n``` {.python .cell-code}\nimport pandas as pd\nimport seaborn as sns\nimport matplotlib.pylab as plt\nimport numpy as np\n\nsns.set_style(\"whitegrid\")\n# %%\n# Source: # https://www.insee.fr/fr/statistiques/serie/001763852\ndf_ipc = pd.read_csv(\"valeurs_mensuelles.csv\", skiprows=6, sep=\";\")\n\n# df_point_indice = pd.read_csv(\"point_indice.csv\")\n\n# %%\ndf_ipc.columns = [\"Date\", \"IPC\", \"Useless\", \"Date2\"]\ndf_ipc.index = pd.to_datetime(df_ipc[\"Date\"], format=\"%Y-%m\")\ndf_ipc.drop(df_ipc.columns[[0, 2]], inplace=True, axis=1)\n\ndf_ipc.head()\n# %%\n# set origin\ninit_date = \"2005-09-01\"\ndf_ipc[\"IPC(idx)\"] = df_ipc[\"IPC\"] / df_ipc.loc[init_date][\"IPC\"]\ndf_ipc.head()\n\n# sort by \"Date\" in ascending order\ndf_ipc.sort_values(by=\"Date\", inplace=True)\n# %%\nsns.lineplot(x=df_ipc.index, y=\"IPC(idx)\", data=df_ipc)\nax = plt.gca()\nax.vlines(\n np.datetime64(init_date),\n ymin=np.min(df_ipc[\"IPC(idx)\"]),\n ymax=1.0,\n color=\"k\",\n linestyle=\"--\",\n)\nax.hlines(\n 1.0,\n xmin=df_ipc[\"IPC\"].idxmin(),\n xmax=np.datetime64(init_date),\n color=\"k\",\n linestyle=\"--\",\n)\n\nax.set_xlim(df_ipc[\"IPC\"].idxmin(), df_ipc[\"IPC\"].idxmax())\nax.set_ylim(df_ipc[\"IPC(idx)\"].min(), df_ipc[\"IPC(idx)\"].max())\n# %%\ndf_pt_idx = pd.read_csv(\"point_indice.csv\", skiprows=1, sep=\",\")\ndf_pt_idx.columns = [\"Date\", \"Point d'indice\"]\n# %%\n\ndf_pt_idx[\"Date\"] = pd.to_datetime(df_pt_idx[\"Date\"], format=\"%d/%m/%Y\")\n\n# df_pt_idx[\"Point d'indice(idx)\"] =df_pt_idx[\"Point d'indice\"]/ df_pt_idx.loc[init_date][\"IPC\"]\n# df_pt_idx.head()\n# %%\n\ndf = pd.merge_asof(df_ipc, df_pt_idx, on=\"Date\")\ndf.index = df[\"Date\"]\n\n\ndf.loc[init_date][\"Point d'indice\"]\ndf[\"Point d'indice(idx)\"] = (\n df[\"Point d'indice\"] / df.loc[init_date][\"Point d'indice\"]\n)\n\ndf[\"Point d'indice(euros constant)\"] = (\n df[\"Point d'indice(idx)\"] / df[\"IPC(idx)\"]\n)\n\n# df_pt_idx.merge(df_ipc, left_index=True, right_index=True, how='inner')\n# %%\n\n\ndf.plot(x=\"Date\", y=[\"IPC(idx)\", \"Point d'indice(idx)\"])\nax = plt.gca()\nax.set_xlim(left=np.datetime64(init_date))\nax.set_ylim(bottom=0.9)\nfig = ax.get_figure()\nfig.savefig(\"./svg/ipc_n_point_indice.svg\")\nfig.savefig(\"./png/ipc_n_point_indice.png\")\nplt.show()\nplt.close(\"all\")\n# %%\n\ndf.plot(\n x=\"Date\",\n y=[\"Point d'indice(euros constant)\"],\n title=\"Point d'indice (€ corrigé de l'inflation):\\n Réference 1 le \"\n + init_date,\n)\nax = plt.gca()\nax.set_xlim(left=np.datetime64(init_date))\nax.set_ylim(bottom=0.80, top=1.2)\nax.legend().remove()\nfig = ax.get_figure()\nfig.savefig(\"./svg/point_indice.svg\")\nfig.savefig(\"./png/point_indice.png\")\n```\n\n::: {.cell-output .cell-output-display}\n![](index_files/figure-html/cell-2-output-1.png){width=589 height=429}\n:::\n\n::: {.cell-output .cell-output-display}\n![](index_files/figure-html/cell-2-output-2.png){width=596 height=429}\n:::\n\n::: {.cell-output .cell-output-display}\n![](index_files/figure-html/cell-2-output-3.png){width=596 height=468}\n:::\n:::\n\n\n::: {.cell execution_count=2}\n``` {.python .cell-code}\nimport datetime\ncurrent_time = datetime.datetime.now()\nprint(\"Computation was performed at : {current_time}(GMT)\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nComputation was performed at : {current_time}(GMT)\n```\n:::\n:::\n\n\nSources are:\n- inflation : [https://www.insee.fr/fr/statistiques/serie/001763852#Telechargement](https://www.insee.fr/fr/statistiques/serie/001763852#Telechargement)\n- point d'indice: [https://fr.wikipedia.org/wiki/Point_d%27indice_salarial_en_France](https://fr.wikipedia.org/wiki/Point_d%27indice_salarial_en_France)\n\n[](https://github.com/josephsalmon/Tweets/tree/master/economics)\n[](https://github.com/josephsalmon/Tweets/tree/master/economics)\n\n", + "markdown": "---\ntitle: \"Public civil servant and inflation rate in France\"\n---\n\nIn the file [fonctionnaires_pauvres.py](fonctionnaires_pauvres.py) we investigated the evolution of the salary of civil servants in France through the \"Point d'indice\" evolution.\n\n\n\n\n\n\n\n::: {.cell execution_count=4}\n\n::: {.cell-output .cell-output-display}\n```{=html}\n
\n```\n:::\n:::\n\n\n::: {.cell execution_count=5}\n\n::: {.cell-output .cell-output-display}\n```{=html}\n
\n```\n:::\n:::\n\n\n::: {.cell execution_count=6}\n``` {.python .cell-code}\nprint(f\"Computation was performed at : {current_time} (GMT)\")\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nComputation was performed at : 2023-09-01 15:23:51.908001 (GMT)\n```\n:::\n:::\n\n\nSources are:\n\n- inflation : [https://www.insee.fr/fr/statistiques/serie/001763852#Telechargement](https://www.insee.fr/fr/statistiques/serie/001763852#Telechargement)\n- point d'indice: [https://www.data.gouv.fr/fr/datasets/r/6b5a3e7e-7de7-437c-b8eb-a04ab4138fbb](https://www.data.gouv.fr/fr/datasets/r/6b5a3e7e-7de7-437c-b8eb-a04ab4138fbb)\n\n", "supporting": [ "index_files" ], "filters": [], - "includes": {} + "includes": { + "include-in-header": [ + "\n\n\n\n\n" + ] + } } } \ No newline at end of file diff --git a/economics/index.qmd b/economics/index.qmd index 7ef8277..587f842 100644 --- a/economics/index.qmd +++ b/economics/index.qmd @@ -23,8 +23,6 @@ from dateutil.relativedelta import relativedelta current_time = datetime.datetime.now() last_date = current_time - relativedelta(months=2) -# Create a function that take a datetime and return the year and month it was two month ago: - fname_inflation = pooch.retrieve(f"https://www.insee.fr/fr/statistiques/serie/telecharger/csv/001763852?ordre=antechronologique&transposition=donneescolonne&periodeDebut=1&anneeDebut=1990&periodeFin={last_date.month}&anneeFin={last_date.year}&revision=sansrevisions", known_hash=None) zf = zipfile.ZipFile(fname_inflation)