diff --git a/notebooks/code_CASD/extractions_erfs/statistiques_descriptives_cas_types_dixiemes.ipynb b/notebooks/code_CASD/extractions_erfs/statistiques_descriptives_cas_types_dixiemes.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..a80910e072119e91b75a64bb05bef76d403ad5ac --- /dev/null +++ b/notebooks/code_CASD/extractions_erfs/statistiques_descriptives_cas_types_dixiemes.ipynb @@ -0,0 +1,1415 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Ce script tourne avec le kernel jupyter leximpact2024 issu de l'environnement conda leximpa construit à partir des dépendances de leximpact-prepare-data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "from openfisca_survey_manager.statshelpers import mark_weighted_percentiles\n", + "import plotly.graph_objects as go\n", + "import plotly.express as px \n", + "from plotly.subplots import make_subplots" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "path_erfs_brut = \"//casd.fr/casdfs/Projets/LEXIMPA/Data/ERFS_ERFS_2021\"\n", + "output_path = \"C:/Users/Public/Documents/TRAVAIL/code_cas_type_ERFS_2021/sorties\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages = pd.read_parquet(f\"{path_erfs_brut}/menage21_aus.parquet\")\n", + "print(f\"nb menages avant selection : {len(menages)}\")\n", + "print(f\"poids menages avant selection : {round(menages.wprm.sum())}\")\n", + "menages = menages.loc[menages['champm'] == 1 ].loc[menages[\"nivviem\"] > 0].sort_values(\"nivviem\").reset_index()\n", + "print(f\"nb menages après selection : {len(menages)}\")\n", + "print(f\"poids menages après selection : {round(menages.wprm.sum())}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "individus = pd.read_parquet(f\"{path_erfs_brut}/indivi21_aus.parquet\")\n", + "print(f\"nb individus avant selection : {len(individus)}\")\n", + "print(f\"poids individus avant selection : {round(individus.wprm.sum())}\")\n", + "individus = individus.loc[individus['ident21'].isin(set(menages.ident21.unique().tolist()))].sort_values(\"nivviem\").reset_index()\n", + "print(f\"nb individus après selection : {len(individus)}\")\n", + "print(f\"poids individus après selection : {round(individus.wprm.sum())}\")\n", + "individus[\"rev_activite_decl\"] = individus.zindi + individus.zsali\n", + "individus.rename(columns = {\"zchoi\":\"chomage_decl\",\"zperi\":\"pensions_decl\"}, inplace = True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# individus.groupby(\"ident21\").agg({'noindiv':'count',\n", + "# 'wprm':'min'}).groupby('noindiv').agg({\"wprm\":\"sum\"})" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Type de ménage\n", + "\n", + "- 1: personne seule\n", + "- 2: famille monoparentale\n", + "- 3: couple sans enfant\n", + "- 4: couple avec enfant\n", + "- 5: autre" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "personne_reference = individus.loc[individus[\"noi\"] == \"01\"][[\"ident21\", \"TYPMEN5\",\"ETAMATRI_Y_comp\",\"NBENFMENCHAMP\",\"rev_activite_decl\", \"chomage_decl\", \"pensions_decl\"]]\n", + "personne_reference.TYPMEN5.isna().sum()\n", + "personne_reference.groupby(\"TYPMEN5\").agg({'ident21':'count'})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "conjoint = individus.loc[individus[\"noi\"] == \"02\"][[\"ident21\", \"rev_activite_decl\", \"chomage_decl\", \"pensions_decl\"]].rename(columns = {\"rev_activite_decl\":\"rev_activite_conj\",\"chomage_decl\":\"chomage_conj\",\"pensions_decl\":\"pensions_conj\"})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages = pd.merge(menages,personne_reference, how='outer', on='ident21')\n", + "menages = pd.merge(menages,conjoint, how='outer', on='ident21')\n", + "menages.TYPMEN5.isna().sum()\n", + "menages[\"TYPMEN5\"] = np.where(menages.TYPMEN5.isna(),\"5\",menages[\"TYPMEN5\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for conj_col in [\"rev_activite_decl\", \"chomage_decl\", \"pensions_decl\",\"rev_activite_conj\", \"chomage_conj\", \"pensions_conj\"]:\n", + " menages[conj_col] = menages[conj_col].fillna(0)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"acteu5pr_lab\"] = menages.acteu5pr.map({\"1\":\"salarié\", \"2\":\"indépendant\",\"3\":\"chomeur\",\"4\":\"retraité\",\"5\":\"inactif autre\"})\n", + "menages[\"acteu5cj_lab\"] = menages.acteu5cj.map({\"1\":\"salarié\", \"2\":\"indépendant\",\"3\":\"chomeur\",\"4\":\"retraité\",\"5\":\"inactif autre\"})\n", + "menages[\"TYPMEN5_lab\"] = menages.TYPMEN5.map({\"1\":\"personne seule\", \"2\":\"famille monoparentale\",\"3\":\"couple sans enfant\",\"4\":\"couple avec enfant(s)\",\"5\":\"autre / n.a\"})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ret, quant = mark_weighted_percentiles(a = menages['nivviem'], labels = np.arange(1, 11), weights = menages['wprm'], method = 2, return_quantiles = True)\n", + "menages[\"dixieme\"] = ret" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "quant" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages.groupby(\"dixieme\").agg({\"nivviem\": \"min\"})\n", + "# Les résultats sont cohérants avec la distribution publiée par l'INSEE en date du 14/11/2023 \"Distribution des niveaux de vie, données annuelles de 1996 à 2021\"\n", + "# --> Prendre les résutlats de cette publication pour les dixièmes de cas types dans l'interface" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## nombre d'enfants dans le ménage" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages['categ_nbenfc'] = np.where(menages[\"NBENFMENCHAMP\"] > 3,3,menages[\"NBENFMENCHAMP\"])\n", + "menages['categ_nbenfc'] = menages.categ_nbenfc.map({0.0:\"Pas d'enfant\", 1.0:\"1 enfant\",2.0:\"2 enfants\",3.0:\"3 enfants et plus\"})\n", + "nb_enfc = menages.groupby([\"dixieme\", \"categ_nbenfc\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_enfc[\"prop\"] = round(100 * nb_enfc.wprm /nb_enfc.groupby(\"dixieme\")['wprm'].transform(\"sum\"))\n", + "nb_enfc[\"distrib\"] = round(100 * nb_enfc.wprm /nb_enfc.groupby(\"categ_nbenfc\")['wprm'].transform(\"sum\"))\n", + "nb_enfc.rename(columns={\"ident21\":\"count\"},inplace = True)\n", + "nb_enfc.to_csv(f\"{output_path}/nb_encf.csv\")\n", + "print(\"Nombre de ménages selon le nombre d'enfants dans le ménage : \")\n", + "nb_enfc.groupby(\"categ_nbenfc\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_nbenfc\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du nombre d'enfants dans ménage par dixieme de niveau de vie\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"categ_nbenfc\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du nombre d'enfants\")\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## nombre de parents / couple" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_typmen = menages.groupby([\"dixieme\", \"TYPMEN5_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_typmen[\"prop\"] = round(100 * nb_typmen.wprm /nb_typmen.groupby(\"dixieme\")['wprm'].transform(\"sum\"))\n", + "nb_typmen[\"distrib\"] = round(100 * nb_typmen.wprm /nb_typmen.groupby(\"TYPMEN5_lab\")['wprm'].transform(\"sum\"))\n", + "nb_typmen.rename(columns={\"ident21\":\"count\"},inplace = True)\n", + "nb_typmen.to_csv(f\"{output_path}/nb_typmen.csv\")\n", + "nb_typmen.groupby(\"TYPMEN5_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_typmen,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"TYPMEN5_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du type de ménage par dixieme de niveau de vie\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_typmen,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"TYPMEN5_lab\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction de leur type\")\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### focus sur le nombre d'enfants en fonction de en couple / familles monoparentales" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_enfc_couple = menages.loc[menages[\"categ_nbenfc\"] != \"Pas d'enfant\"].groupby([\"dixieme\", \"TYPMEN5\", \"TYPMEN5_lab\", \"categ_nbenfc\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_enfc_couple.rename(columns = {\"ident21\":\"count\"},inplace = True)\n", + "nb_enfc_couple[\"prop\"] = round(100 * nb_enfc_couple.wprm /nb_enfc_couple.groupby([\"dixieme\",\"TYPMEN5\",\"TYPMEN5_lab\"])['wprm'].transform(\"sum\"))\n", + "nb_enfc_couple[\"distrib\"] = round(100 * nb_enfc_couple.wprm /nb_enfc_couple.groupby([\"categ_nbenfc\", \"TYPMEN5\",\"TYPMEN5_lab\"])['wprm'].transform(\"sum\"))\n", + "nb_enfc_couple[\"somme_categ_parents\"] = nb_enfc_couple.groupby([\"categ_nbenfc\", \"TYPMEN5\",\"TYPMEN5_lab\"])['wprm'].transform(\"sum\")\n", + "nb_enfc_couple[\"wprm\"] = np.where((nb_enfc_couple.categ_nbenfc != \"1 enfant\") & (nb_enfc_couple.dixieme >= 6), np.nan, nb_enfc_couple[\"wprm\"])\n", + "nb_enfc_couple = nb_enfc_couple.loc[nb_enfc_couple.wprm.isna() == False]\n", + "nb_enfc_couple.to_csv(f\"{output_path}/nb_enfc_couple.csv\")\n", + "nb_enfc_couple.groupby(\"categ_nbenfc\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "data_fig = nb_enfc_couple[[\"categ_nbenfc\", \"somme_categ_parents\",\"TYPMEN5\",\"TYPMEN5_lab\"]].drop_duplicates()\n", + "fig = make_subplots(\n", + " rows = 1,\n", + " cols = 2,\n", + " specs=[\n", + " [{\"type\":\"domain\"},{\"type\":\"domain\"}]\n", + " ],\n", + " subplot_titles= [f\"Familles monoparentales : {round(data_fig.loc[nb_enfc_couple['TYPMEN5'] == '2'].somme_categ_parents.sum()/1e6, ndigits = 2)} millions de ménages\", f\"Couples : {round(data_fig.loc[nb_enfc_couple['TYPMEN5'] == '4'].somme_categ_parents.sum()/1e6, ndigits = 2)} millions de ménages\"]\n", + ")\n", + "\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = data_fig.loc[data_fig[\"TYPMEN5\"] == \"2\"].categ_nbenfc,\n", + " values = data_fig.loc[data_fig[\"TYPMEN5\"] == \"2\"].somme_categ_parents,\n", + " scalegroup=\"one\",\n", + " name = \"Famille monoparentale\"\n", + " ),\n", + " 1,\n", + " 1\n", + ")\n", + "\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = data_fig.loc[data_fig[\"TYPMEN5\"] == \"4\"].categ_nbenfc,\n", + " values = data_fig.loc[data_fig[\"TYPMEN5\"] == \"4\"].somme_categ_parents,\n", + " scalegroup=\"one\",\n", + " name = \"Couple\"\n", + " ),\n", + " 1,\n", + " 2\n", + ")\n", + "fig.update_layout(legend = dict(title = \"Nombre d'enfants\"))\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc_couple,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_nbenfc\",\n", + " text_auto = True,\n", + " nbins = 10,\n", + " facet_col = \"TYPMEN5_lab\"\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du nombre d'enfants à charge par dixieme de niveau de vie, à gauche les familles monoparentales, à droite les couples\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc_couple,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"categ_nbenfc\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " facet_col = \"TYPMEN5_lab\"\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du nombre d'enfants, à gauche les familles monoparentales, à droite les couples\")\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### statut marital des couples\n", + "\n", + "- 1: Marié.e\n", + "- 2: Pacsé.e\n", + "- 3: union libre\n", + "- 4: veuf.ve\n", + "- 5: divorcé.e\n", + "- 6: dépacsé.e\n", + "- 7: séparé.e\n", + "- 8: célibataire\n", + "- 9: non répose" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages['categ_etamatri'] = menages.ETAMATRI_Y_comp.map({\"1\":\"Marié/Pacsé\",\"2\":\"Marié/Pacsé\",\"3\":\"Union libre\",\"4\":\"Célibataire\",\"5\":\"Célibataire\",\"6\":\"Célibataire\",\"7\":\"Célibataire\",\"8\":\"Célibataire\",\"9\":\"n.a\"})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_enfc_couple = menages.groupby([\"dixieme\", \"TYPMEN5\", \"categ_etamatri\"]).agg({\"wprm\":\"sum\"}).reset_index()\n", + "nb_enfc_couple[\"prop\"] = round(100 * nb_enfc_couple.wprm /nb_enfc_couple.groupby([\"dixieme\",\"TYPMEN5\"])['wprm'].transform(\"sum\"))\n", + "nb_enfc_couple[\"distrib\"] = round(100 * nb_enfc_couple.wprm /nb_enfc_couple.groupby([\"categ_etamatri\", \"TYPMEN5\"])['wprm'].transform(\"sum\"))\n", + "nb_enfc_couple.groupby(\"categ_etamatri\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc_couple,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_etamatri\",\n", + " text_auto = True,\n", + " nbins = 10,\n", + " facet_col = \"TYPMEN5\"\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du nombre d'enfants à charge par dixieme de niveau de vie, à gauche les familles monoparentales, à droite les couples\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc_couple,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"categ_etamatri\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " facet_col = \"TYPMEN5\"\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du nombre d'enfants, à gauche les familles monoparentales, à droite les couples\")\n", + "fig.show()\n", + "\n", + "# - 1: Marié.e\n", + "# - 2: Pacsé.e\n", + "# - 3: union libre\n", + "# - 4: veuf.ve\n", + "# - 5: divorcé.e\n", + "# - 6: dépacsé.e\n", + "# - 7: séparé.e\n", + "# - 8: célibataire\n", + "# - 9: non répose" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Statuts d'activité de la personne de référence et du conjoint\n", + "\n", + "- 1: salarié\n", + "- 2: indépendant\n", + "- 3: chômeur\n", + "- 4: retraité \n", + "- 5: inactif non retraité" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(f\"Nombre de na pour le conjoint : {menages.acteu5cj.isna().sum()}\")\n", + "menages.groupby(\"acteu5cj_lab\").agg({\"wprm\":\"count\"})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages.loc[menages.acteu5cj.isna()].groupby(\"TYPMEN5_lab\").agg({\"wprm\": \"sum\"}) # que 300 \"anomalie\" de couple où pas de conjoint retrouvé" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages.loc[menages.acteu5cj.isna() == False].groupby(\"TYPMEN5_lab\").agg({\"wprm\": \"sum\"}) # plus d'anomalie" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(f\"Nombre de na pour la personne de référence : {menages.acteu5pr.isna().sum()}\")\n", + "menages.groupby(\"acteu5pr_lab\").agg({\"wprm\":\"count\"})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb = menages.groupby([\"dixieme\", \"acteu5pr_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb[\"prop\"] = round(100 * nb.wprm /nb.groupby(\"dixieme\")['wprm'].transform(\"sum\"))\n", + "nb[\"distrib\"] = round(100 * nb.wprm /nb.groupby(\"acteu5pr_lab\")['wprm'].transform(\"sum\"))\n", + "nb.to_csv(f\"{output_path}/nb_acteu5pr.csv\")\n", + "nb.groupby(\"acteu5pr_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"acteu5pr_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du statut d'activité de la personne de référence par dixieme de niveau de vie\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"acteu5pr_lab\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du statut d'activité de la personne de référence\")\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb = menages.loc[menages[\"TYPMEN5\"] != \"1\"].loc[menages[\"TYPMEN5\"] != \"2\"].loc[menages[\"TYPMEN5\"] != \"5\"].groupby([\"dixieme\", \"acteu5cj_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb[\"prop\"] = round(100 * nb.wprm /nb.groupby(\"dixieme\")['wprm'].transform(\"sum\"))\n", + "nb[\"distrib\"] = round(100 * nb.wprm /nb.groupby(\"acteu5cj_lab\")['wprm'].transform(\"sum\"))\n", + "nb.to_csv(f\"{output_path}/nb_acteu5cj.csv\")\n", + "nb.groupby(\"acteu5cj_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#new_name = {\"1\":\"salarié.e\", \"2\":\"indépendant.e\",\"3\":\"chomeureuse\",\"4\":\"retraité\",\"5\":\"inactif.ve autre\"}\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"acteu5cj_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du statut d'activité du conjoint par dixieme de niveau de vie\", bargap = 0.2)\n", + "#fig.for_each_trace(lambda t: t.update(name = new_name[t.name]))\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"acteu5cj_lab\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du statut d'activité du conjoint\")\n", + "#fig.for_each_trace(lambda t: t.update(name = new_name[t.name]))\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb = menages.loc[menages[\"TYPMEN5\"] != \"1\"].loc[menages[\"TYPMEN5\"] != \"2\"].loc[menages[\"TYPMEN5\"] != \"5\"].groupby([\"dixieme\", \"acteu5pr\", \"acteu5cj\"]).agg({\"wprm\":\"sum\"}).reset_index()\n", + "nb[\"prop\"] = round(100 * nb.wprm /nb.groupby([\"dixieme\",\"acteu5pr\"])['wprm'].transform(\"sum\"))\n", + "nb[\"distrib\"] = round(100 * nb.wprm /nb.groupby([\"acteu5cj\", \"acteu5pr\"])['wprm'].transform(\"sum\"))\n", + "nb.groupby(\"acteu5cj\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = make_subplots(\n", + " rows = 3,\n", + " cols = 2,\n", + " specs=[\n", + " [{\"type\":\"domain\"},{\"type\":\"domain\"}],\n", + " [{\"type\":\"domain\"},{\"type\":\"domain\"}],\n", + " [{\"type\":\"domain\"},{\"type\":\"domain\"}]\n", + " ],\n", + " horizontal_spacing=0,\n", + " vertical_spacing=0\n", + " #subplot_titles= [f\"Familles monoparentales : {round(nb_enfc_couple.loc[nb_enfc_couple['TYPMEN5'] == '2'].wprm.sum()/1e6, ndigits = 2)} millions de ménages\", f\"Couples : {round(nb_enfc_couple.loc[nb_enfc_couple['TYPMEN5'] == '4'].wprm.sum()/1e6, ndigits = 2)} millions de ménages\"]\n", + ")\n", + "\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = nb.loc[nb[\"acteu5pr\"] == \"1\"].acteu5cj,\n", + " values = nb.loc[nb[\"acteu5pr\"] == \"1\"].wprm,\n", + " scalegroup=\"one\",\n", + " name = \"Salarié\"\n", + " ),\n", + " 1,\n", + " 1\n", + ")\n", + "\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = nb.loc[nb[\"acteu5pr\"] == \"2\"].acteu5cj,\n", + " values = nb.loc[nb[\"acteu5pr\"] == \"2\"].wprm,\n", + " scalegroup=\"one\",\n", + " name = \"Indépendant.e\"\n", + " ),\n", + " 1,\n", + " 2\n", + ")\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = nb.loc[nb[\"acteu5pr\"] == \"3\"].acteu5cj,\n", + " values = nb.loc[nb[\"acteu5pr\"] == \"3\"].wprm,\n", + " scalegroup=\"one\",\n", + " name = \"Chomeureuse\"\n", + " ),\n", + " 2,\n", + " 1\n", + ")\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = nb.loc[nb[\"acteu5pr\"] == \"4\"].acteu5cj,\n", + " values = nb.loc[nb[\"acteu5pr\"] == \"4\"].wprm,\n", + " scalegroup=\"one\",\n", + " name = \"Retraité.e\"\n", + " ),\n", + " 2,\n", + " 2\n", + ")\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = nb.loc[nb[\"acteu5pr\"] == \"5\"].acteu5cj,\n", + " values = nb.loc[nb[\"acteu5pr\"] == \"5\"].wprm,\n", + " scalegroup=\"one\",\n", + " name = \"Inactif.ve autre\"\n", + " ),\n", + " 3,\n", + " 1\n", + ")\n", + "fig.update_layout(legend = dict(title = \"Statut d'activité\",x= 0.75,y=0.005), margin = dict(l=10,r=10,b=0,t=0))\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"acteu5cj\",\n", + " text_auto = True,\n", + " nbins = 10,\n", + " facet_col = \"acteu5pr\"\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du nombre d'enfants à charge par dixieme de niveau de vie, à gauche les familles monoparentales, à droite les couples\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"acteu5cj\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " facet_col = \"acteu5pr\"\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du nombre d'enfants, à gauche les familles monoparentales, à droite les couples\")\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## statut d'occupation du logement \n", + "- 1 accédant à la propriété\n", + "- 2 propriétaire\n", + "- 3 locataire HLM\n", + "- 4 locataire vide\n", + "- 5 locataire meublé\n", + "- 6 logé gratuitement\n", + "- 7 usufruitier\n", + "- 9 non réponse" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages.groupby(\"logT\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages['categ_logmnt'] = np.where(menages[\"logT\"] == \"5\",\"4\",menages[\"logT\"])\n", + "menages['categ_logmnt'] = np.where(menages[\"logT\"] == \"9\",\"6\", menages[\"categ_logmnt\"])\n", + "menages['categ_logmnt'] = np.where(menages[\"logT\"] == \"1\",\"2\", menages[\"categ_logmnt\"])\n", + "menages['categ_logmnt_lab'] = menages.categ_logmnt.map({\"2\":\"Propriétaire\",\"3\":\"Locataire HLM\",\"4\":\"Locataire privé\",\"6\":\"Autre\"})\n", + "nb_logtm = menages.groupby([\"dixieme\", \"categ_logmnt_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_logtm[\"prop\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"dixieme\")['wprm'].transform(\"sum\"))\n", + "nb_logtm[\"distrib\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].transform(\"sum\"))\n", + "nb_logtm.rename(columns = {\"ident21\":\"count\"},inplace = True)\n", + "nb_logtm.to_csv(f\"{output_path}/nb_logtm.csv\")\n", + "nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "#new_name = {\"2\":\"Propriétaire\",\"3\":\"Locataire HLM\",\"4\":\"Locataire privé\",\"6\":\"Autre\"}\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_logtm,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_logmnt_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction de leur statut d'occupation du logement\", bargap = 0.2)\n", + "#fig.for_each_trace(lambda t: t.update(name = new_name[t.name]))\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_logtm,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"categ_logmnt_lab\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction de leur statut d'occupation du logement\")\n", + "#fig.for_each_trace(lambda t: t.update(name = new_name[t.name]))\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Part des propriétaires en fonction du statut d'occupation du type de ménage" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_logtm = menages.groupby([\"dixieme\", \"categ_logmnt_lab\", \"TYPMEN5_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_logtm[\"prop\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby([\"dixieme\", \"TYPMEN5_lab\"])['wprm'].transform(\"sum\"))\n", + "#nb_logtm[\"distrib\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].transform(\"sum\"))\n", + "nb_logtm.rename(columns = {\"ident21\":\"count\"},inplace = True)\n", + "nb_logtm = nb_logtm.loc[nb_logtm[\"categ_logmnt_lab\"] == \"Propriétaire\"]\n", + "nb_logtm = nb_logtm.loc[nb_logtm[\"TYPMEN5_lab\"] != \"autre / n.a\"]\n", + "nb_logtm.to_csv(f\"{output_path}/nb_logtm_typmen.csv\")\n", + "#nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_logtm,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " barmode=\"group\",\n", + " color = \"TYPMEN5_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction de leur statut d'occupation du logement\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_logtm = menages.groupby([\"dixieme\", \"categ_logmnt_lab\", \"acteu5pr_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_logtm[\"prop\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby([\"dixieme\", \"acteu5pr_lab\"])['wprm'].transform(\"sum\"))\n", + "#nb_logtm[\"distrib\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].transform(\"sum\"))\n", + "nb_logtm.rename(columns = {\"ident21\":\"count\"},inplace = True)\n", + "nb_logtm = nb_logtm.loc[nb_logtm[\"categ_logmnt_lab\"] == \"Propriétaire\"]\n", + "nb_logtm.to_csv(f\"{output_path}/nb_logtm_acteu5pr.csv\")\n", + "#nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_logtm,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " barmode=\"group\",\n", + " color = \"acteu5pr_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des propriétaires en fonction du statut d'activité de la personne de référence\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Revenus déclarés" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "revdispm =\n", + "\n", + "+ revperm (revdecm (ztsam (zsalm + zchom) + zperm (zrstm + zpim + zrtom + zalrm) + zragm + zricm + zrncm + zfonm + zvamm + zvalm + zracm + zetrm -zalvm) + revexom + produitfin - csgim (csgsalim + csghsupim + csgchoim + csgrstim + csgragim + csgricim + csgrncim + csgpiim) - crdsm ( crdssalm + crdshsupm + crdschom + crdsrstm + crdsragm + crdsricm + crdsrncm + crdspim) - csgimpm (produits financiers imputés) - csgvalm (csg crds valeurs mobilières) - zimpvalm (prélèvement libératoire sur valeur mobilière du ménage))\n", + "+ psocm (pfamm + mibim + logtm)\n", + "- zimpom (impot sur le revenu)\n", + "- zthabm\n", + "- csgpatm (csg-crds sur revenus du patrimoine)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "prelevements = zimpom + zthabm + csgpatm + zimpvalm + csgvalm + csgimpm + crdsm + csgim\n", + "\n", + "prestations = pfamm + minim + logtm\n", + "\n", + "revenus = revenus_activite + revenus_remplacement + revenus_foncier_capital\n", + "\n", + "revenus_activite = zsalm + revexom + zragm + zricm + zrncm + zracm - zalvm + zetrm\n", + "revenus_remplacement = zchom + zrstm + zpim + zrtom + zalrm\n", + "revenus_foncier_capital = zfonm + zvamm + zvalm + produitfin" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"prelevements\"] = menages.zimpom + menages.zthabm + menages.csgpatm + menages.zimpvalm + menages.csgvalm + menages.csgimpm + menages.crdsm + menages.csgim\n", + "menages[\"impots\"] = menages.zimpom + menages.zthabm + menages.zimpvalm\n", + "# prelevements = impots + csg imposable + crds\n", + "menages.rename(columns = {\"psocm\":\"prestations\"},inplace = True)\n", + "menages[\"revenus_activite\"] = menages.zsalm + menages.revexom + menages.zragm + menages.zricm + menages.zrncm + menages.zracm - menages.zalvm + menages.zetrm\n", + "# traitement et salaires hors chomage, revenus exonérés (primes / heures sup.) + revenus des indépendants + revenus étrangers - pensions alimentaires versées\n", + "menages[\"revenus_remplacement\"] = menages.zchom + menages.zrstm + menages.zpim + menages.zrtom + menages.zalrm\n", + "# chomage + retraite + pension invalidite + rente viagière à titre onéreux + pension alimentaire recue\n", + "menages[\"revenus_foncier_capital\"] = menages.zfonm + menages.zvamm + menages.zvalm + menages.produitfin\n", + "menages[\"revenus\"] = menages[\"revenus_activite\"] + menages[\"revenus_remplacement\"] + menages[\"revenus_foncier_capital\"]\n", + "menages[\"diff\"] = menages[\"revdispm\"] - (menages[\"revenus\"] - menages[\"prelevements\"] + menages[\"prestations\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sum(abs(menages[\"diff\"]) > 1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"revdecm_net\"] = menages[\"revdecm\"] - menages[\"csgdm\"]\n", + "# revenus = [\n", + "# \"ztsam\", # zchom + zsalm\n", + "# \"zchom\",\n", + "# \"zsalm\",\n", + "# \"zperm\",\n", + "# \"zalrm\", # pensions alim recues, dans zalrm\n", + "# \"zragm\",\n", + "# \"zricm\",\n", + "# \"zrncm\",\n", + "# \"zfonm\",\n", + "# \"zvamm\",\n", + "# \"zvalm\",\n", + "# \"zracm\",\n", + "# \"zetrm\",\n", + "# \"zalvm\",\n", + "# ]\n", + "\n", + "revenus = [\n", + " \"revenus_activite\",\n", + " \"revenus_remplacement\",\n", + " \"revenus_foncier_capital\"\n", + "]\n", + "\n", + "prelevements = [\"prelevements\", \"impots\"]\n", + "\n", + "rev_tot = [ \n", + " \"revdecm\",\n", + " \"revdecm_net\",\n", + " \"revdispm\",\n", + " \"revenus\",\n", + " \"prestations\"] \n", + "for rev in revenus + rev_tot + prelevements:\n", + " menages[f\"{rev}_pond\"] = menages[rev].fillna(0) * menages.wprm\n", + " menages[f\"{rev}_uc_pond\"] = menages[rev].fillna(0) / menages[\"nb_UCI\"].fillna(1) * menages.wprm\n", + "\n", + "agg = {f\"{rev}_pond\":\"sum\" for rev in revenus + rev_tot + prelevements}\n", + "agg.update({\"wprm\":\"sum\",\"ident21\":\"count\"})\n", + "agg.update({f\"{rev}_uc_pond\":\"sum\" for rev in revenus + rev_tot + prelevements})\n", + "menages[\"revenus_individus\"] = (np.maximum(0,menages[\"rev_activite_conj\"]) + menages[\"chomage_conj\"] + menages[\"pensions_conj\"] + np.maximum(0,menages[\"rev_activite_decl\"]) + menages[\"chomage_decl\"] + menages[\"pensions_decl\"])\n", + "menages[\"part_rev_decl\"] = np.where(menages[\"revenus_individus\"] > 0, np.maximum(0,menages[\"rev_activite_decl\"]) + menages[\"chomage_decl\"] + menages[\"pensions_decl\"] / menages[\"revenus_individus\"],0)\n", + "menages[\"prestations_positives\"] = (menages[\"prestations\"] > 0) * menages[\"wprm\"]\n", + "menages[\"revenus_positifs\"] = (menages[\"revenus\"] > 0) * menages[\"wprm\"]\n", + "menages[\"revenus_act_positifs\"] = (menages[\"revenus_activite\"] > 0) * menages[\"wprm\"]\n", + "menages[\"revenus_remp_positifs\"] = (menages[\"revenus_remplacement\"] > 0) * menages[\"wprm\"]\n", + "menages[\"revenus_fon_cap_positifs\"] = (menages[\"revenus_foncier_capital\"] > 0) * menages[\"wprm\"]\n", + "menages[\"impot_negatif\"] = (menages[\"impots\"] > 0) * menages[\"wprm\"]# si impot positif alors le menage paie de l'impot\n", + "menages[\"ni_impot_ni_presta\"] =(menages[\"prestations\"] == 0) * (menages[\"impots\"] == 0) * menages[\"wprm\"]\n", + "agg.update({\"impot_negatif\":\"sum\",\"revenus_positifs\":\"sum\",\"revenus_act_positifs\":\"sum\",\"revenus_remp_positifs\":\"sum\",\"revenus_fon_cap_positifs\":\"sum\",\"prestations_positives\":\"sum\",\"ni_impot_ni_presta\":\"sum\"})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# agg = {f\"{rev}\":\"max\" for rev in revenus + rev_tot + prelevements}\n", + "# nb_max = menages.groupby([\"dixieme\"]).agg(agg).reset_index()\n", + "# nb_max.rename(columns = {rev:f\"{rev}_max\" for rev in nb_max.columns if rev != \"dixieme\"}, inplace = True)\n", + "# agg = {f\"{rev}\":\"sum\" for rev in revenus + rev_tot + prelevements}\n", + "# nb = menages.groupby([\"dixieme\"]).agg(agg).reset_index()\n", + "# nb = pd.merge(nb_max,nb,on = \"dixieme\")\n", + "# for rev in revenus + rev_tot + prelevements:\n", + "# nb[f\"{rev}_part_max\"] = nb[f\"{rev}_max\"] / nb[f\"{rev}\"]\n", + "# nb.to_csv(f\"{output_path}/check_part_max_nb_revenus.csv\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb = menages.groupby([\"dixieme\"]).agg(agg).reset_index()\n", + "nb.to_csv(f\"{output_path}/nb_revenus.csv\")\n", + "for rev in revenus + rev_tot + prelevements:\n", + " nb[f\"{rev}_prop\"] = nb[f\"{rev}_pond\"] / nb[\"revenus_pond\"]\n", + " nb[f\"{rev}_moy\"] = nb[f\"{rev}_pond\"] / nb[\"wprm\"]\n", + " nb[f\"{rev}_uc_prop\"] = nb[f\"{rev}_uc_pond\"] / nb[\"revenus_uc_pond\"]\n", + " nb[f\"{rev}_uc_moy\"] = nb[f\"{rev}_uc_pond\"] / nb[\"wprm\"]\n", + "nb[\"prestations_positives_prop\"] = nb[\"prestations_positives\"] / nb[\"wprm\"]\n", + "nb[\"revenus_positifs_prop\"] = nb[\"revenus_positifs\"] / nb[\"wprm\"]\n", + "nb[\"revenus_act_positifs_prop\"] = nb[\"revenus_act_positifs\"] / nb[\"wprm\"]\n", + "nb[\"revenus_remp_positifs_prop\"] = nb[\"revenus_remp_positifs\"] / nb[\"wprm\"]\n", + "nb[\"revenus_fon_cap_positifs_prop\"] = nb[\"revenus_fon_cap_positifs\"] / nb[\"wprm\"]\n", + "nb[\"impot_negatif_prop\"] = nb[\"impot_negatif\"] / nb[\"wprm\"]\n", + "nb[\"ni_impot_ni_presta_prop\"] = nb[\"ni_impot_ni_presta\"] / nb[\"wprm\"]\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig.add_trace(\n", + " go.Line(\n", + " x = nb.dixieme,\n", + " y = nb[\"revdecm_uc_moy\"],\n", + " name = \"revdecm_uc_moy\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Line(\n", + " x = nb.dixieme,\n", + " y = nb[\"revdispm_uc_moy\"],\n", + " name = \"revdispm_uc_moy\",\n", + " )\n", + ")\n", + "#fig.update_layout(title = \"Part des menages en fonction de leur statut d'occupation du logement\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "for rev in revenus:\n", + " fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[f\"{rev}_prop\"],\n", + " name = rev,\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Part des différentes catégories de revenus par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "for rev in revenus:\n", + " fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[f\"{rev}_uc_prop\"],\n", + " name = rev,\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Part des différentes catégories de revenus par uc par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "for rev in [\"prestations_positives_prop\", \"impot_negatif_prop\", \"ni_impot_ni_presta_prop\",\"revenus_positifs_prop\",\"revenus_act_positifs_prop\",\"revenus_remp_positifs_prop\",\"revenus_fon_cap_positifs_prop\"]:\n", + " fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[f\"{rev}\"],\n", + " name = rev,\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Part des personnes payant des impots, recevant des prestations sociales ou aucun des deux par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "#for rev in [\"prestations_positives_prop\", \"impot_negatif_prop\", \"ni_impot_ni_presta_prop\"]:\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"prestations_uc_pond\"] / nb[\"prestations_positives\"],\n", + " name = \"Montant moyen de prestation\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"impots_uc_pond\"] / nb[\"impot_negatif\"],\n", + " name = \"Montant moyen d'impot\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"revenus_activite_uc_pond\"] / nb[\"revenus_act_positifs\"],\n", + " name = \"Montant moyen de revenus d'activité\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"revenus_remplacement_uc_pond\"] / nb[\"revenus_remp_positifs\"],\n", + " name = \"Montant moyen de revenus de remplacement\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"revenus_foncier_capital_uc_pond\"] / nb[\"revenus_fon_cap_positifs\"],\n", + " name = \"Montant moyen de revenus fonciers et du capital\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"revenus_uc_pond\"] / nb[\"revenus_positifs\"],\n", + " name = \"Montant moyen de revenus\",\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Part des personnes payant des impots, recevant des prestations sociales ou aucun des deux par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "for rev in [\"revenus\",\"prestations\",\"revenus_activite\",\"revenus_remplacement\"]:\n", + " fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[f\"{rev}_uc_moy\"],\n", + " name = rev,\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Montants moyens de revenus imposables et de prestations par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Analyse par dixième " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"acteu5pr\"] = menages.acteu5pr.map({\"1\":\"1\", \"2\":\"1\",\"3\":\"2\",\"4\":\"3\",\"5\":\"2\"})\n", + "menages[\"acteu5cj\"] = menages.acteu5cj.map({\"1\":\"1\", \"2\":\"1\",\"3\":\"2\",\"4\":\"3\",\"5\":\"2\"})\n", + "menages[\"acteu5pr_lab\"] = menages.acteu5pr.map({\"1\":\"en emploi\", \"2\":\"sans emploi\",\"3\":\"retraité\"})\n", + "menages[\"acteu5cj_lab\"] = menages.acteu5cj.map({\"1\":\"en emploi\", \"2\":\"sans emploi\",\"3\":\"retraité\"})\n", + "menages[\"categ_logmnt_lab\"] = np.where(menages[\"categ_logmnt_lab\"] == \"Autre\", 'Propriétaire',menages[\"categ_logmnt_lab\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "test = menages.groupby([\"dixieme\",\"TYPMEN5_lab\",\"acteu5pr_lab\"]).agg({\"revenus_uc_pond\":\"sum\",\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index().sort_values([\"dixieme\",\"TYPMEN5_lab\", \"wprm\"])\n", + "test_check = menages.groupby([\"dixieme\",\"TYPMEN5_lab\",\"acteu5pr_lab\"]).agg({\"revenus_uc_pond\":\"max\"}).reset_index()\n", + "test_check.rename(columns = {\"revenus_uc_pond\":\"revenus_uc_max\"}, inplace = True)\n", + "test = pd.merge(test_check,test, on = [\"dixieme\",\"TYPMEN5_lab\",\"acteu5pr_lab\"])\n", + "test[\"check_poids_max\"] = test[\"revenus_uc_max\"] / test[\"revenus_uc_pond\"]\n", + "test[\"revenus_uc_moy\"] = test.revenus_uc_pond / test.wprm\n", + "test = test.loc[test[\"TYPMEN5_lab\"]!= \"autre / n.a\"]\n", + "test.rename(columns = {'ident21':'count'},inplace = True)\n", + "test = test.loc[test[\"wprm\"] > 200000]\n", + "test.to_csv(f\"{output_path}/check_cas_majoritaire_dixieme.csv\")\n", + "test = test.drop(columns = [\"check_poids_max\", \"revenus_uc_max\"])\n", + "test.to_csv(f\"{output_path}/cas_majoritaire_dixieme.csv\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# SMIC net 2021 après csg et crds, source série chornologique INSEE, pour 35h de travail \n", + "smic = 9 * 1230.6 + 3 * 1258.22\n", + "smic" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"part_rev_decl_pond\"] = menages.part_rev_decl * menages.wprm" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_moy(data, group_var):\n", + " moy = data.groupby(group_var).agg({\"ident21\":\"count\",\"wprm\":\"sum\",\"revenus_pond\":\"sum\",\"prestations_pond\":\"sum\",\"agprl_pond\":\"sum\",\"revenus_remplacement_pond\":\"sum\",\"revenus_activite_pond\":\"sum\",\"revenus_foncier_capital_pond\":\"sum\",\"part_rev_decl_pond\":\"sum\"})\n", + " moy.rename(columns={\"ident21\":\"count\"},inplace = True)\n", + " moy[\"revenus_moy\"] = moy.revenus_pond / moy.wprm\n", + " moy[\"revenus_remplacement_moy\"] = moy.revenus_remplacement_pond / moy.wprm\n", + " moy[\"revenus_activite_moy\"] = moy.revenus_activite_pond / moy.wprm\n", + " moy[\"revenus_fon_cap_moy\"] = moy.revenus_foncier_capital_pond / moy.wprm\n", + " moy[\"prestations_moy\"] = moy.prestations_pond / moy.wprm\n", + " moy[\"age_moy\"] = moy.agprl_pond / moy.wprm\n", + " #moy[\"part_rev_decl_moy\"] = moy.part_rev_decl_pond / moy.wprm\n", + " moy[\"rev_pourc_smic\"] = moy.revenus_moy / smic\n", + " moy = moy.drop([\"revenus_pond\",\"prestations_pond\",\"agprl_pond\",\"revenus_remplacement_pond\",\"revenus_activite_pond\",\"revenus_foncier_capital_pond\",\"part_rev_decl_pond\"], axis = 1)\n", + " return moy" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_logmnt(data,group_var):\n", + " nb_logtm = data.groupby([group_var, \"categ_logmnt_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + " nb_logtm.rename(columns={\"ident21\":\"count\"},inplace = True)\n", + " nb_logtm[\"prop\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(group_var)['wprm'].transform(\"sum\"))\n", + " nb_logtm[\"distrib\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].transform(\"sum\"))\n", + " nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].agg(\"sum\")\n", + " print(nb_logtm)\n", + " fig = go.Figure()\n", + " fig = px.histogram(nb_logtm,\n", + " x = group_var,\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_logmnt_lab\",\n", + " text_auto = True,\n", + " nbins = 5\n", + " )\n", + " fig.update_layout(title = \"Part des menages en fonction de leur statut d'occupation du logement\", bargap = 0.2)\n", + " fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def analyse_personne_seule(data):\n", + " print(\"Répartition des statut d'activité de la personne : \")\n", + " print(100*data.groupby('acteu5pr_lab').agg({\"wprm\":\"sum\"})/data.wprm.sum())\n", + "\n", + " moy = compute_moy(data, \"acteu5pr_lab\")\n", + " print(\"Moyenne des revenus par catégorie d'actitivité : \")\n", + " print(moy)\n", + "\n", + " compute_logmnt(data, \"acteu5pr_lab\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_statut_couple(data):\n", + " nb = data.groupby([\"acteu5pr_lab\", \"acteu5cj_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + " nb.rename(columns = {\"ident21\":\"count\"})\n", + " nb[\"prop\"] = round(100 * nb.wprm /nb.groupby(\"acteu5pr_lab\")['wprm'].transform(\"sum\"))\n", + " nb[\"distrib\"] = round(100 * nb.wprm /nb.groupby(\"acteu5cj_lab\")['wprm'].transform(\"sum\"))\n", + " nb.groupby(\"acteu5cj_lab\")['wprm'].agg(\"sum\")\n", + " print(nb)\n", + " fig = go.Figure()\n", + " fig = px.histogram(nb,\n", + " x = \"acteu5pr_lab\",\n", + " y = \"prop\",\n", + " #barmode=\"acteu5cj\",\n", + " color = \"acteu5cj_lab\",\n", + " text_auto = True,\n", + " nbins = 5\n", + " )\n", + " fig.update_layout(title = \"Part des menages en fonction de leur statut d'activité\", bargap = 0.2)\n", + " fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def analyse_couple(data):\n", + " print(\"Statut activité adulte 1\")\n", + " print(100*data.groupby('acteu5pr_lab').agg({\"wprm\":\"sum\"})/data.wprm.sum())\n", + " print(\"Statut activité adulte 2\")\n", + " print(100*data.groupby('acteu5cj_lab').agg({\"wprm\":\"sum\"})/data.wprm.sum())\n", + " compute_statut_couple(data)\n", + " print(\"Nombre d'apporteur de ressources du ménage\")\n", + " #temp = data.groupby('nbres').agg({\"wprm\":\"sum\",\"part_rev_decl_pond\":\"sum\"})\n", + " #temp[\"part_rev_decl_moy\"] = 100*temp.part_rev_decl_pond / temp.wprm\n", + " temp = data.groupby('nbres').agg({\"wprm\":\"sum\"}).reset_index()\n", + " temp[\"wprm\"] = 100 * temp.wprm/data.wprm.sum()\n", + " #print(temp[[\"wprm\",\"part_rev_decl_moy\"]])\n", + " print(temp.loc[temp['nbres'] < 3][[\"wprm\"]])\n", + " moy = compute_moy(data, \"acteu5pr_lab\")\n", + " print(\"Moyenne des revenus par catégorie d'actitivité de l'adulte 1 : \")\n", + " print(moy)\n", + " compute_logmnt(data, \"acteu5pr_lab\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def analyse_quantile(quantile):\n", + " print(f\" \\n __________________ QUANTILE {quantile} ____________________\")\n", + "\n", + " print(\" \\n ***** Personne seule ***** \\n\")\n", + " focus_type = focus.loc[focus[\"TYPMEN5\"] == \"1\"]\n", + " if quantile >= 5:\n", + " focus_type = focus_type.loc[focus.acteu5pr != \"2\"] # on enlève les sans emploi dans le haut de la distribution car pas assez de monde\n", + " analyse_personne_seule(focus_type)\n", + " #menages = menages.loc[menages[\"TYPMEN5\"] != \"5\"]\n", + " print(\" \\n ***** Couple sans enfant ***** \\n\")\n", + " focus_type = focus.loc[focus[\"TYPMEN5\"] == \"3\"]\n", + " analyse_couple(focus_type)\n", + " print(\" \\n ***** Couple avec enfant(s) ***** \\n\")\n", + " focus_type = focus.loc[focus[\"TYPMEN5\"] == \"4\"]\n", + " focus_type['acteu5pr_lab'] = np.where(focus_type['acteu5pr_lab'] == \"retraité\",\"sans emploi\",focus_type['acteu5pr_lab'])\n", + " focus_type['acteu5cj_lab'] = np.where(focus_type['acteu5cj_lab'] == \"retraité\",\"sans emploi\",focus_type['acteu5cj_lab'])\n", + " analyse_couple(focus_type)\n", + "\n", + " if quantile < 4:\n", + " print(\" \\n ***** Famille monoparentale ***** \\n\")\n", + " focus_type = focus.loc[focus[\"TYPMEN5\"] == \"2\"]\n", + " focus_type['acteu5pr_lab'] = np.where(focus_type['acteu5pr_lab'] == \"retraité\",\"sans emploi\",focus_type['acteu5pr_lab'])\n", + " analyse_personne_seule(focus_type)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for i in range(1,2):\n", + " analyse_quantile(i)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for quantile in range(1,11):\n", + " analyse_quantile(quantile)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "leximpact2024-kernel", + "language": "python", + "name": "leximpact2024-kernel" + }, + "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.10.13" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/notebooks/memos/memo_dixieme_niveau_de_vie.ipynb b/notebooks/memos/memo_dixieme_niveau_de_vie.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..f29fd85ee97c32d2bbe5f96967dfa5cb9c6c4256 --- /dev/null +++ b/notebooks/memos/memo_dixieme_niveau_de_vie.ipynb @@ -0,0 +1,12889 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Ce script tourne avec le kernel jupyter leximpact2024 issu de l'environnement conda leximpa construit à partir des dépendances de leximpact-prepare-data" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "from openfisca_survey_manager.statshelpers import mark_weighted_percentiles\n", + "import plotly.graph_objects as go\n", + "import plotly.express as px \n", + "from plotly.subplots import make_subplots" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "data_path = \"/mnt/data-in/casd_extract/erfs/20240306_erfs_2021_stats_dixieme\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Type de ménage\n", + "\n", + "- 1: personne seule\n", + "- 2: famille monoparentale\n", + "- 3: couple sans enfant\n", + "- 4: couple avec enfant\n", + "- 5: autre" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## nombre d'enfants dans le ménage" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=1 enfant<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "1 enfant", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "1 enfant", + "nbinsx": 10, + "offsetgroup": "1 enfant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 13, + 13, + 13, + 13, + 15, + 16, + 15, + 16, + 14, + 15 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=2 enfants<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "2 enfants", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "2 enfants", + "nbinsx": 10, + "offsetgroup": "2 enfants", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 12, + 12, + 12, + 13, + 13, + 13, + 14, + 14, + 13, + 12 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=3 enfants et plus<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "3 enfants et plus", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "3 enfants et plus", + "nbinsx": 10, + "offsetgroup": "3 enfants et plus", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 13, + 10, + 8, + 6, + 5, + 4, + 4, + 3, + 3, + 3 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=Pas d'enfant<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "Pas d'enfant", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "Pas d'enfant", + "nbinsx": 10, + "offsetgroup": "Pas d'enfant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 62, + 65, + 67, + 68, + 67, + 67, + 67, + 67, + 70, + 70 + ], + "yaxis": "y" + } + ], + "layout": { + "bargap": 0.2, + "barmode": "relative", + "legend": { + "title": { + "text": "categ_nbenfc" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Part des menages en fonction du nombre d'enfants dans ménage par dixieme de niveau de vie" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of prop" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=1 enfant<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "1 enfant", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "1 enfant", + "nbinsx": 10, + "offsetgroup": "1 enfant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 9, + 9, + 9, + 9, + 11, + 11, + 11, + 11, + 10, + 10 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=2 enfants<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "2 enfants", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "2 enfants", + "nbinsx": 10, + "offsetgroup": "2 enfants", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 9, + 9, + 9, + 10, + 10, + 11, + 11, + 11, + 10, + 9 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=3 enfants et plus<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "3 enfants et plus", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "3 enfants et plus", + "nbinsx": 10, + "offsetgroup": "3 enfants et plus", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 22, + 17, + 13, + 10, + 8, + 7, + 6, + 5, + 6, + 5 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=Pas d'enfant<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "Pas d'enfant", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "Pas d'enfant", + "nbinsx": 10, + "offsetgroup": "Pas d'enfant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 9, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 11 + ], + "yaxis": "y" + } + ], + "layout": { + "barmode": "group", + "legend": { + "title": { + "text": "categ_nbenfc" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Distribution des ménages en fonction du nombre d'enfants" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of distrib" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "nb_enfc = pd.read_csv(f\"{data_path}/nb_encf.csv\")\n", + "\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_nbenfc\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du nombre d'enfants dans ménage par dixieme de niveau de vie\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"categ_nbenfc\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du nombre d'enfants\")\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## nombre de parents / couple" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=autre / n.a<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "autre / n.a", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "autre / n.a", + "nbinsx": 10, + "offsetgroup": "autre / n.a", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 6, + 5, + 4, + 5, + 4, + 4, + 4, + 4, + 4, + 3 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=couple avec enfant(s)<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "couple avec enfant(s)", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "couple avec enfant(s)", + "nbinsx": 10, + "offsetgroup": "couple avec enfant(s)", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 19, + 19, + 20, + 22, + 25, + 26, + 26, + 26, + 26, + 26 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=couple sans enfant<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "couple sans enfant", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "couple sans enfant", + "nbinsx": 10, + "offsetgroup": "couple sans enfant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 10, + 14, + 18, + 21, + 22, + 26, + 28, + 32, + 36, + 39 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=famille monoparentale<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "famille monoparentale", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "famille monoparentale", + "nbinsx": 10, + "offsetgroup": "famille monoparentale", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 17, + 15, + 12, + 9, + 8, + 6, + 6, + 5, + 4, + 3 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=personne seule<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "personne seule", + "marker": { + "color": "#FFA15A", + "pattern": { + "shape": "" + } + }, + "name": "personne seule", + "nbinsx": 10, + "offsetgroup": "personne seule", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 47, + 47, + 46, + 44, + 42, + 38, + 36, + 33, + 30, + 29 + ], + "yaxis": "y" + } + ], + "layout": { + "bargap": 0.2, + "barmode": "relative", + "legend": { + "title": { + "text": "TYPMEN5_lab" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Part des menages en fonction du type de ménage par dixieme de niveau de vie" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of prop" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=autre / n.a<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "autre / n.a", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "autre / n.a", + "nbinsx": 10, + "offsetgroup": "autre / n.a", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 14, + 12, + 11, + 11, + 8, + 10, + 10, + 8, + 10, + 7 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=couple avec enfant(s)<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "couple avec enfant(s)", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "couple avec enfant(s)", + "nbinsx": 10, + "offsetgroup": "couple avec enfant(s)", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 8, + 8, + 8, + 9, + 11, + 11, + 11, + 11, + 11, + 11 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=couple sans enfant<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "couple sans enfant", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "couple sans enfant", + "nbinsx": 10, + "offsetgroup": "couple sans enfant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 4, + 6, + 7, + 8, + 9, + 11, + 11, + 13, + 15, + 16 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=famille monoparentale<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "famille monoparentale", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "famille monoparentale", + "nbinsx": 10, + "offsetgroup": "famille monoparentale", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 20, + 17, + 14, + 11, + 9, + 7, + 7, + 6, + 5, + 3 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "TYPMEN5_lab=personne seule<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "personne seule", + "marker": { + "color": "#FFA15A", + "pattern": { + "shape": "" + } + }, + "name": "personne seule", + "nbinsx": 10, + "offsetgroup": "personne seule", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 12, + 12, + 12, + 11, + 11, + 10, + 9, + 8, + 8, + 7 + ], + "yaxis": "y" + } + ], + "layout": { + "barmode": "group", + "legend": { + "title": { + "text": "TYPMEN5_lab" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Distribution des ménages en fonction de leur type" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of distrib" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "nb_typmen = pd.read_csv(f\"{data_path}/nb_typmen.csv\")\n", + "\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_typmen,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"TYPMEN5_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du type de ménage par dixieme de niveau de vie\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_typmen,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"TYPMEN5_lab\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction de leur type\")\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### focus sur le nombre d'enfants en fonction de en couple / familles monoparentales" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_enfc_couple = menages.loc[menages[\"categ_nbenfc\"] != \"Pas d'enfant\"].groupby([\"dixieme\", \"TYPMEN5\", \"TYPMEN5_lab\", \"categ_nbenfc\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_enfc_couple.rename(columns = {\"ident21\":\"count\"},inplace = True)\n", + "nb_enfc_couple[\"prop\"] = round(100 * nb_enfc_couple.wprm /nb_enfc_couple.groupby([\"dixieme\",\"TYPMEN5\",\"TYPMEN5_lab\"])['wprm'].transform(\"sum\"))\n", + "nb_enfc_couple[\"distrib\"] = round(100 * nb_enfc_couple.wprm /nb_enfc_couple.groupby([\"categ_nbenfc\", \"TYPMEN5\",\"TYPMEN5_lab\"])['wprm'].transform(\"sum\"))\n", + "nb_enfc_couple[\"somme_categ_parents\"] = nb_enfc_couple.groupby([\"categ_nbenfc\", \"TYPMEN5\",\"TYPMEN5_lab\"])['wprm'].transform(\"sum\")\n", + "nb_enfc_couple[\"wprm\"] = np.where((nb_enfc_couple.categ_nbenfc != \"1 enfant\") & (nb_enfc_couple.dixieme >= 6), np.nan, nb_enfc_couple[\"wprm\"])\n", + "nb_enfc_couple = nb_enfc_couple.loc[nb_enfc_couple.wprm.isna() == False]\n", + "nb_enfc_couple.to_csv(f\"{output_path}/nb_enfc_couple.csv\")\n", + "nb_enfc_couple.groupby(\"categ_nbenfc\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "domain": { + "x": [ + 0, + 0.45 + ], + "y": [ + 0, + 1 + ] + }, + "labels": [ + "1 enfant", + "2 enfants", + "3 enfants et plus" + ], + "name": "Famille monoparentale", + "scalegroup": "one", + "type": "pie", + "values": [ + 1449105.2682485308, + 753321.4944382856, + 281009.44373598683 + ] + }, + { + "domain": { + "x": [ + 0.55, + 1 + ], + "y": [ + 0, + 1 + ] + }, + "labels": [ + "1 enfant", + "2 enfants", + "3 enfants et plus" + ], + "name": "Couple", + "scalegroup": "one", + "type": "pie", + "values": [ + 2632798.600772802, + 2851579.1406036657, + 1350518.8906251676 + ] + } + ], + "layout": { + "annotations": [ + { + "font": { + "size": 16 + }, + "showarrow": false, + "text": "Familles monoparentales : 2.48 millions de ménages", + "x": 0.225, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "font": { + "size": 16 + }, + "showarrow": false, + "text": "Couples : 6.83 millions de ménages", + "x": 0.775, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + } + ], + "legend": { + "title": { + "text": "Nombre d'enfants" + } + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "nb_enfc_couple = pd.read_csv(f\"{data_path}/nb_enfc_couple.csv\")\n", + "\n", + "data_fig = nb_enfc_couple[[\"categ_nbenfc\", \"somme_categ_parents\",\"TYPMEN5\",\"TYPMEN5_lab\"]].drop_duplicates()\n", + "fig = make_subplots(\n", + " rows = 1,\n", + " cols = 2,\n", + " specs=[\n", + " [{\"type\":\"domain\"},{\"type\":\"domain\"}]\n", + " ],\n", + " subplot_titles= [f\"Familles monoparentales : {round(data_fig.loc[nb_enfc_couple['TYPMEN5'] == 2].somme_categ_parents.sum()/1e6, ndigits = 2)} millions de ménages\", f\"Couples : {round(data_fig.loc[nb_enfc_couple['TYPMEN5'] == 4].somme_categ_parents.sum()/1e6, ndigits = 2)} millions de ménages\"]\n", + ")\n", + "\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = data_fig.loc[data_fig[\"TYPMEN5\"] == 2].categ_nbenfc,\n", + " values = data_fig.loc[data_fig[\"TYPMEN5\"] == 2].somme_categ_parents,\n", + " scalegroup=\"one\",\n", + " name = \"Famille monoparentale\"\n", + " ),\n", + " 1,\n", + " 1\n", + ")\n", + "\n", + "fig.add_trace(\n", + " go.Pie(\n", + " labels = data_fig.loc[data_fig[\"TYPMEN5\"] == 4].categ_nbenfc,\n", + " values = data_fig.loc[data_fig[\"TYPMEN5\"] == 4].somme_categ_parents,\n", + " scalegroup=\"one\",\n", + " name = \"Couple\"\n", + " ),\n", + " 1,\n", + " 2\n", + ")\n", + "fig.update_layout(legend = dict(title = \"Nombre d'enfants\"))\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=1 enfant<br>TYPMEN5_lab=famille monoparentale<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "1 enfant", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "1 enfant", + "nbinsx": 10, + "offsetgroup": "1 enfant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 45, + 49, + 54, + 64, + 71, + 72, + 69, + 69, + 71, + 69 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=1 enfant<br>TYPMEN5_lab=couple avec enfant(s)<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "1 enfant", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "1 enfant", + "nbinsx": 10, + "offsetgroup": "1 enfant", + "orientation": "v", + "showlegend": false, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x2", + "y": [ + 26, + 27, + 32, + 34, + 38, + 41, + 42, + 46, + 42, + 48 + ], + "yaxis": "y2" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=2 enfants<br>TYPMEN5_lab=famille monoparentale<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "2 enfants", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "2 enfants", + "nbinsx": 10, + "offsetgroup": "2 enfants", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5 + ], + "xaxis": "x", + "y": [ + 33, + 34, + 35, + 31, + 26 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=2 enfants<br>TYPMEN5_lab=couple avec enfant(s)<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "2 enfants", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "2 enfants", + "nbinsx": 10, + "offsetgroup": "2 enfants", + "orientation": "v", + "showlegend": false, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5 + ], + "xaxis": "x2", + "y": [ + 31, + 35, + 37, + 44, + 44 + ], + "yaxis": "y2" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=3 enfants et plus<br>TYPMEN5_lab=famille monoparentale<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "3 enfants et plus", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "3 enfants et plus", + "nbinsx": 10, + "offsetgroup": "3 enfants et plus", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5 + ], + "xaxis": "x", + "y": [ + 23, + 17, + 11, + 6, + 4 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=3 enfants et plus<br>TYPMEN5_lab=couple avec enfant(s)<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "3 enfants et plus", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "3 enfants et plus", + "nbinsx": 10, + "offsetgroup": "3 enfants et plus", + "orientation": "v", + "showlegend": false, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5 + ], + "xaxis": "x2", + "y": [ + 43, + 38, + 31, + 23, + 17 + ], + "yaxis": "y2" + } + ], + "layout": { + "annotations": [ + { + "font": {}, + "showarrow": false, + "text": "TYPMEN5_lab=famille monoparentale", + "x": 0.245, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "font": {}, + "showarrow": false, + "text": "TYPMEN5_lab=couple avec enfant(s)", + "x": 0.755, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + } + ], + "bargap": 0.2, + "barmode": "relative", + "legend": { + "title": { + "text": "categ_nbenfc" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Part des menages en fonction du nombre d'enfants à charge par dixieme de niveau de vie, à gauche les familles monoparentales, à droite les couples" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 0.49 + ], + "title": { + "text": "dixieme" + } + }, + "xaxis2": { + "anchor": "y2", + "domain": [ + 0.51, + 1 + ], + "matches": "x", + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of prop" + } + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=1 enfant<br>TYPMEN5_lab=famille monoparentale<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "1 enfant", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "1 enfant", + "nbinsx": 10, + "offsetgroup": "1 enfant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 16, + 14, + 13, + 12, + 11, + 9, + 8, + 7, + 6, + 4 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=1 enfant<br>TYPMEN5_lab=couple avec enfant(s)<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "1 enfant", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "1 enfant", + "nbinsx": 10, + "offsetgroup": "1 enfant", + "orientation": "v", + "showlegend": false, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x2", + "y": [ + 6, + 6, + 7, + 8, + 10, + 12, + 12, + 13, + 12, + 14 + ], + "yaxis": "y2" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=2 enfants<br>TYPMEN5_lab=famille monoparentale<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "2 enfants", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "2 enfants", + "nbinsx": 10, + "offsetgroup": "2 enfants", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5 + ], + "xaxis": "x", + "y": [ + 22, + 19, + 17, + 11, + 8 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=2 enfants<br>TYPMEN5_lab=couple avec enfant(s)<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "2 enfants", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "2 enfants", + "nbinsx": 10, + "offsetgroup": "2 enfants", + "orientation": "v", + "showlegend": false, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5 + ], + "xaxis": "x2", + "y": [ + 6, + 7, + 7, + 10, + 11 + ], + "yaxis": "y2" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=3 enfants et plus<br>TYPMEN5_lab=famille monoparentale<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "3 enfants et plus", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "3 enfants et plus", + "nbinsx": 10, + "offsetgroup": "3 enfants et plus", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5 + ], + "xaxis": "x", + "y": [ + 41, + 26, + 13, + 5, + 3 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "categ_nbenfc=3 enfants et plus<br>TYPMEN5_lab=couple avec enfant(s)<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "3 enfants et plus", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "3 enfants et plus", + "nbinsx": 10, + "offsetgroup": "3 enfants et plus", + "orientation": "v", + "showlegend": false, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5 + ], + "xaxis": "x2", + "y": [ + 18, + 16, + 13, + 11, + 9 + ], + "yaxis": "y2" + } + ], + "layout": { + "annotations": [ + { + "font": {}, + "showarrow": false, + "text": "TYPMEN5_lab=famille monoparentale", + "x": 0.245, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "font": {}, + "showarrow": false, + "text": "TYPMEN5_lab=couple avec enfant(s)", + "x": 0.755, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + } + ], + "barmode": "group", + "legend": { + "title": { + "text": "categ_nbenfc" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Distribution des ménages en fonction du nombre d'enfants, à gauche les familles monoparentales, à droite les couples" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 0.49 + ], + "title": { + "text": "dixieme" + } + }, + "xaxis2": { + "anchor": "y2", + "domain": [ + 0.51, + 1 + ], + "matches": "x", + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of distrib" + } + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc_couple,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_nbenfc\",\n", + " text_auto = True,\n", + " nbins = 10,\n", + " facet_col = \"TYPMEN5_lab\"\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du nombre d'enfants à charge par dixieme de niveau de vie, à gauche les familles monoparentales, à droite les couples\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_enfc_couple,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"categ_nbenfc\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " facet_col = \"TYPMEN5_lab\"\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du nombre d'enfants, à gauche les familles monoparentales, à droite les couples\")\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### statut marital des couples\n", + "\n", + "- 1: Marié.e\n", + "- 2: Pacsé.e\n", + "- 3: union libre\n", + "- 4: veuf.ve\n", + "- 5: divorcé.e\n", + "- 6: dépacsé.e\n", + "- 7: séparé.e\n", + "- 8: célibataire\n", + "- 9: non répose" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Statuts d'activité de la personne de référence et du conjoint\n", + "\n", + "- 1: salarié\n", + "- 2: indépendant\n", + "- 3: chômeur\n", + "- 4: retraité \n", + "- 5: inactif non retraité" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=chomeur<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "chomeur", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "chomeur", + "nbinsx": 10, + "offsetgroup": "chomeur", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 16, + 7, + 5, + 4, + 3, + 2, + 2, + 2, + 1, + 2 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=inactif autre<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "inactif autre", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "inactif autre", + "nbinsx": 10, + "offsetgroup": "inactif autre", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 24, + 11, + 5, + 3, + 2, + 1, + 2, + 2, + 1, + 2 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=indépendant<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "indépendant", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "indépendant", + "nbinsx": 10, + "offsetgroup": "indépendant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 10, + 6, + 6, + 5, + 5, + 5, + 6, + 7, + 9, + 18 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=retraité<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "retraité", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "retraité", + "nbinsx": 10, + "offsetgroup": "retraité", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 27, + 39, + 41, + 37, + 34, + 35, + 32, + 30, + 29, + 24 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=salarié<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "salarié", + "marker": { + "color": "#FFA15A", + "pattern": { + "shape": "" + } + }, + "name": "salarié", + "nbinsx": 10, + "offsetgroup": "salarié", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 24, + 36, + 43, + 51, + 56, + 56, + 59, + 60, + 60, + 54 + ], + "yaxis": "y" + } + ], + "layout": { + "bargap": 0.2, + "barmode": "relative", + "legend": { + "title": { + "text": "acteu5pr_lab" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Part des menages en fonction du statut d'activité de la personne de référence par dixieme de niveau de vie" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of prop" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=chomeur<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "chomeur", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "chomeur", + "nbinsx": 10, + "offsetgroup": "chomeur", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 37, + 17, + 11, + 8, + 6, + 5, + 4, + 4, + 2, + 4 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=inactif autre<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "inactif autre", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "inactif autre", + "nbinsx": 10, + "offsetgroup": "inactif autre", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 45, + 21, + 10, + 6, + 4, + 2, + 3, + 3, + 2, + 3 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=indépendant<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "indépendant", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "indépendant", + "nbinsx": 10, + "offsetgroup": "indépendant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 13, + 8, + 7, + 6, + 7, + 7, + 7, + 9, + 12, + 24 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=retraité<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "retraité", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "retraité", + "nbinsx": 10, + "offsetgroup": "retraité", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 8, + 12, + 13, + 11, + 10, + 11, + 10, + 9, + 9, + 7 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5pr_lab=salarié<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "salarié", + "marker": { + "color": "#FFA15A", + "pattern": { + "shape": "" + } + }, + "name": "salarié", + "nbinsx": 10, + "offsetgroup": "salarié", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 5, + 7, + 9, + 10, + 11, + 11, + 12, + 12, + 12, + 11 + ], + "yaxis": "y" + } + ], + "layout": { + "barmode": "group", + "legend": { + "title": { + "text": "acteu5pr_lab" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Distribution des ménages en fonction du statut d'activité de la personne de référence" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of distrib" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "nb = pd.read_csv(f\"{data_path}/nb_acteu5pr.csv\")\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"acteu5pr_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du statut d'activité de la personne de référence par dixieme de niveau de vie\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"acteu5pr_lab\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du statut d'activité de la personne de référence\")\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=chomeur<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "chomeur", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "chomeur", + "nbinsx": 10, + "offsetgroup": "chomeur", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 8, + 5, + 3, + 3, + 4, + 2, + 1, + 2, + 2, + 2 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=inactif autre<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "inactif autre", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "inactif autre", + "nbinsx": 10, + "offsetgroup": "inactif autre", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 53, + 35, + 24, + 12, + 11, + 8, + 7, + 6, + 7, + 8 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=indépendant<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "indépendant", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "indépendant", + "nbinsx": 10, + "offsetgroup": "indépendant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 8, + 6, + 5, + 5, + 4, + 5, + 5, + 5, + 7, + 14 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=retraité<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "retraité", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "retraité", + "nbinsx": 10, + "offsetgroup": "retraité", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 17, + 32, + 38, + 39, + 37, + 36, + 35, + 34, + 32, + 28 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=salarié<br>dixieme=%{x}<br>sum of prop=%{y}<extra></extra>", + "legendgroup": "salarié", + "marker": { + "color": "#FFA15A", + "pattern": { + "shape": "" + } + }, + "name": "salarié", + "nbinsx": 10, + "offsetgroup": "salarié", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 14, + 22, + 30, + 41, + 44, + 49, + 51, + 52, + 52, + 48 + ], + "yaxis": "y" + } + ], + "layout": { + "bargap": 0.2, + "barmode": "relative", + "legend": { + "title": { + "text": "acteu5cj_lab" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Part des menages en fonction du statut d'activité du conjoint par dixieme de niveau de vie" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of prop" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=chomeur<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "chomeur", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "chomeur", + "nbinsx": 10, + "offsetgroup": "chomeur", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 17, + 12, + 9, + 11, + 12, + 8, + 6, + 8, + 7, + 10 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=inactif autre<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "inactif autre", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "inactif autre", + "nbinsx": 10, + "offsetgroup": "inactif autre", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 23, + 17, + 13, + 8, + 7, + 6, + 6, + 5, + 7, + 8 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=indépendant<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "indépendant", + "marker": { + "color": "#00cc96", + "pattern": { + "shape": "" + } + }, + "name": "indépendant", + "nbinsx": 10, + "offsetgroup": "indépendant", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 8, + 6, + 6, + 6, + 6, + 8, + 8, + 10, + 13, + 28 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=retraité<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "retraité", + "marker": { + "color": "#ab63fa", + "pattern": { + "shape": "" + } + }, + "name": "retraité", + "nbinsx": 10, + "offsetgroup": "retraité", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 3, + 7, + 9, + 10, + 11, + 12, + 12, + 13, + 13, + 11 + ], + "yaxis": "y" + }, + { + "alignmentgroup": "True", + "bingroup": "x", + "histfunc": "sum", + "hovertemplate": "acteu5cj_lab=salarié<br>dixieme=%{x}<br>sum of distrib=%{y}<extra></extra>", + "legendgroup": "salarié", + "marker": { + "color": "#FFA15A", + "pattern": { + "shape": "" + } + }, + "name": "salarié", + "nbinsx": 10, + "offsetgroup": "salarié", + "orientation": "v", + "showlegend": true, + "texttemplate": "%{value}", + "type": "histogram", + "x": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "xaxis": "x", + "y": [ + 2, + 4, + 5, + 8, + 10, + 12, + 13, + 15, + 16, + 15 + ], + "yaxis": "y" + } + ], + "layout": { + "barmode": "group", + "legend": { + "title": { + "text": "acteu5cj_lab" + }, + "tracegroupgap": 0 + }, + "margin": { + "t": 60 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Distribution des ménages en fonction du statut d'activité du conjoint" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "dixieme" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "sum of distrib" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "nb = pd.read_csv(f\"{data_path}/nb_acteu5cj.csv\")\n", + "#new_name = {\"1\":\"salarié.e\", \"2\":\"indépendant.e\",\"3\":\"chomeureuse\",\"4\":\"retraité\",\"5\":\"inactif.ve autre\"}\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"acteu5cj_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction du statut d'activité du conjoint par dixieme de niveau de vie\", bargap = 0.2)\n", + "#fig.for_each_trace(lambda t: t.update(name = new_name[t.name]))\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"acteu5cj_lab\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10,\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction du statut d'activité du conjoint\")\n", + "#fig.for_each_trace(lambda t: t.update(name = new_name[t.name]))\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## statut d'occupation du logement \n", + "- 1 accédant à la propriété\n", + "- 2 propriétaire\n", + "- 3 locataire HLM\n", + "- 4 locataire vide\n", + "- 5 locataire meublé\n", + "- 6 logé gratuitement\n", + "- 7 usufruitier\n", + "- 9 non réponse" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages['categ_logmnt'] = np.where(menages[\"logT\"] == \"5\",\"4\",menages[\"logT\"])\n", + "menages['categ_logmnt'] = np.where(menages[\"logT\"] == \"9\",\"6\", menages[\"categ_logmnt\"])\n", + "menages['categ_logmnt'] = np.where(menages[\"logT\"] == \"1\",\"2\", menages[\"categ_logmnt\"])\n", + "menages['categ_logmnt_lab'] = menages.categ_logmnt.map({\"2\":\"Propriétaire\",\"3\":\"Locataire HLM\",\"4\":\"Locataire privé\",\"6\":\"Autre\"})\n", + "nb_logtm = menages.groupby([\"dixieme\", \"categ_logmnt_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_logtm[\"prop\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"dixieme\")['wprm'].transform(\"sum\"))\n", + "nb_logtm[\"distrib\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].transform(\"sum\"))\n", + "nb_logtm.rename(columns = {\"ident21\":\"count\"},inplace = True)\n", + "nb_logtm.to_csv(f\"{output_path}/nb_logtm.csv\")\n", + "nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_logtm = pd.read_csv(f\"{data_path}/nb_logtm.csv\")\n", + "\n", + "#new_name = {\"2\":\"Propriétaire\",\"3\":\"Locataire HLM\",\"4\":\"Locataire privé\",\"6\":\"Autre\"}\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_logtm,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_logmnt_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction de leur statut d'occupation du logement\", bargap = 0.2)\n", + "#fig.for_each_trace(lambda t: t.update(name = new_name[t.name]))\n", + "fig.show()\n", + "fig = go.Figure()\n", + "fig = px.histogram(nb_logtm,\n", + " x = \"dixieme\",\n", + " y = \"distrib\",\n", + " color = \"categ_logmnt_lab\",\n", + " barmode = \"group\",\n", + " text_auto = True,\n", + " nbins= 10\n", + " )\n", + "fig.update_layout(title = \"Distribution des ménages en fonction de leur statut d'occupation du logement\")\n", + "#fig.for_each_trace(lambda t: t.update(name = new_name[t.name]))\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Part des propriétaires en fonction du statut d'occupation du type de ménage" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_logtm = menages.groupby([\"dixieme\", \"categ_logmnt_lab\", \"TYPMEN5_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_logtm[\"prop\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby([\"dixieme\", \"TYPMEN5_lab\"])['wprm'].transform(\"sum\"))\n", + "#nb_logtm[\"distrib\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].transform(\"sum\"))\n", + "nb_logtm.rename(columns = {\"ident21\":\"count\"},inplace = True)\n", + "nb_logtm = nb_logtm.loc[nb_logtm[\"categ_logmnt_lab\"] == \"Propriétaire\"]\n", + "nb_logtm = nb_logtm.loc[nb_logtm[\"TYPMEN5_lab\"] != \"autre / n.a\"]\n", + "nb_logtm.to_csv(f\"{output_path}/nb_logtm_typmen.csv\")\n", + "#nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_logtm,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " barmode=\"group\",\n", + " color = \"TYPMEN5_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des menages en fonction de leur statut d'occupation du logement\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb_logtm = menages.groupby([\"dixieme\", \"categ_logmnt_lab\", \"acteu5pr_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + "nb_logtm[\"prop\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby([\"dixieme\", \"acteu5pr_lab\"])['wprm'].transform(\"sum\"))\n", + "#nb_logtm[\"distrib\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].transform(\"sum\"))\n", + "nb_logtm.rename(columns = {\"ident21\":\"count\"},inplace = True)\n", + "nb_logtm = nb_logtm.loc[nb_logtm[\"categ_logmnt_lab\"] == \"Propriétaire\"]\n", + "nb_logtm.to_csv(f\"{output_path}/nb_logtm_acteu5pr.csv\")\n", + "#nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].agg(\"sum\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig = px.histogram(nb_logtm,\n", + " x = \"dixieme\",\n", + " y = \"prop\",\n", + " barmode=\"group\",\n", + " color = \"acteu5pr_lab\",\n", + " text_auto = True,\n", + " nbins = 10\n", + " )\n", + "fig.update_layout(title = \"Part des propriétaires en fonction du statut d'activité de la personne de référence\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Revenus déclarés" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "revdispm =\n", + "\n", + "+ revperm (revdecm (ztsam (zsalm + zchom) + zperm (zrstm + zpim + zrtom + zalrm) + zragm + zricm + zrncm + zfonm + zvamm + zvalm + zracm + zetrm -zalvm) + revexom + produitfin - csgim (csgsalim + csghsupim + csgchoim + csgrstim + csgragim + csgricim + csgrncim + csgpiim) - crdsm ( crdssalm + crdshsupm + crdschom + crdsrstm + crdsragm + crdsricm + crdsrncm + crdspim) - csgimpm (produits financiers imputés) - csgvalm (csg crds valeurs mobilières) - zimpvalm (prélèvement libératoire sur valeur mobilière du ménage))\n", + "+ psocm (pfamm + mibim + logtm)\n", + "- zimpom (impot sur le revenu)\n", + "- zthabm\n", + "- csgpatm (csg-crds sur revenus du patrimoine)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "prelevements = zimpom + zthabm + csgpatm + zimpvalm + csgvalm + csgimpm + crdsm + csgim\n", + "\n", + "prestations = pfamm + minim + logtm\n", + "\n", + "revenus = revenus_activite + revenus_remplacement + revenus_foncier_capital\n", + "\n", + "revenus_activite = zsalm + revexom + zragm + zricm + zrncm + zracm - zalvm + zetrm\n", + "revenus_remplacement = zchom + zrstm + zpim + zrtom + zalrm\n", + "revenus_foncier_capital = zfonm + zvamm + zvalm + produitfin" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"prelevements\"] = menages.zimpom + menages.zthabm + menages.csgpatm + menages.zimpvalm + menages.csgvalm + menages.csgimpm + menages.crdsm + menages.csgim\n", + "menages[\"impots\"] = menages.zimpom + menages.zthabm + menages.zimpvalm\n", + "# prelevements = impots + csg imposable + crds\n", + "menages.rename(columns = {\"psocm\":\"prestations\"},inplace = True)\n", + "menages[\"revenus_activite\"] = menages.zsalm + menages.revexom + menages.zragm + menages.zricm + menages.zrncm + menages.zracm - menages.zalvm + menages.zetrm\n", + "# traitement et salaires hors chomage, revenus exonérés (primes / heures sup.) + revenus des indépendants + revenus étrangers - pensions alimentaires versées\n", + "menages[\"revenus_remplacement\"] = menages.zchom + menages.zrstm + menages.zpim + menages.zrtom + menages.zalrm\n", + "# chomage + retraite + pension invalidite + rente viagière à titre onéreux + pension alimentaire recue\n", + "menages[\"revenus_foncier_capital\"] = menages.zfonm + menages.zvamm + menages.zvalm + menages.produitfin\n", + "menages[\"revenus\"] = menages[\"revenus_activite\"] + menages[\"revenus_remplacement\"] + menages[\"revenus_foncier_capital\"]\n", + "menages[\"diff\"] = menages[\"revdispm\"] - (menages[\"revenus\"] - menages[\"prelevements\"] + menages[\"prestations\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sum(abs(menages[\"diff\"]) > 1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"revdecm_net\"] = menages[\"revdecm\"] - menages[\"csgdm\"]\n", + "# revenus = [\n", + "# \"ztsam\", # zchom + zsalm\n", + "# \"zchom\",\n", + "# \"zsalm\",\n", + "# \"zperm\",\n", + "# \"zalrm\", # pensions alim recues, dans zalrm\n", + "# \"zragm\",\n", + "# \"zricm\",\n", + "# \"zrncm\",\n", + "# \"zfonm\",\n", + "# \"zvamm\",\n", + "# \"zvalm\",\n", + "# \"zracm\",\n", + "# \"zetrm\",\n", + "# \"zalvm\",\n", + "# ]\n", + "\n", + "revenus = [\n", + " \"revenus_activite\",\n", + " \"revenus_remplacement\",\n", + " \"revenus_foncier_capital\"\n", + "]\n", + "\n", + "prelevements = [\"prelevements\", \"impots\"]\n", + "\n", + "rev_tot = [ \n", + " \"revdecm\",\n", + " \"revdecm_net\",\n", + " \"revdispm\",\n", + " \"revenus\",\n", + " \"prestations\"] \n", + "for rev in revenus + rev_tot + prelevements:\n", + " menages[f\"{rev}_pond\"] = menages[rev].fillna(0) * menages.wprm\n", + " menages[f\"{rev}_uc_pond\"] = menages[rev].fillna(0) / menages[\"nb_UCI\"].fillna(1) * menages.wprm\n", + "\n", + "agg = {f\"{rev}_pond\":\"sum\" for rev in revenus + rev_tot + prelevements}\n", + "agg.update({\"wprm\":\"sum\",\"ident21\":\"count\"})\n", + "agg.update({f\"{rev}_uc_pond\":\"sum\" for rev in revenus + rev_tot + prelevements})\n", + "menages[\"revenus_individus\"] = (np.maximum(0,menages[\"rev_activite_conj\"]) + menages[\"chomage_conj\"] + menages[\"pensions_conj\"] + np.maximum(0,menages[\"rev_activite_decl\"]) + menages[\"chomage_decl\"] + menages[\"pensions_decl\"])\n", + "menages[\"part_rev_decl\"] = np.where(menages[\"revenus_individus\"] > 0, np.maximum(0,menages[\"rev_activite_decl\"]) + menages[\"chomage_decl\"] + menages[\"pensions_decl\"] / menages[\"revenus_individus\"],0)\n", + "menages[\"prestations_positives\"] = (menages[\"prestations\"] > 0) * menages[\"wprm\"]\n", + "menages[\"revenus_positifs\"] = (menages[\"revenus\"] > 0) * menages[\"wprm\"]\n", + "menages[\"revenus_act_positifs\"] = (menages[\"revenus_activite\"] > 0) * menages[\"wprm\"]\n", + "menages[\"revenus_remp_positifs\"] = (menages[\"revenus_remplacement\"] > 0) * menages[\"wprm\"]\n", + "menages[\"revenus_fon_cap_positifs\"] = (menages[\"revenus_foncier_capital\"] > 0) * menages[\"wprm\"]\n", + "menages[\"impot_negatif\"] = (menages[\"impots\"] > 0) * menages[\"wprm\"]# si impot positif alors le menage paie de l'impot\n", + "menages[\"ni_impot_ni_presta\"] =(menages[\"prestations\"] == 0) * (menages[\"impots\"] == 0) * menages[\"wprm\"]\n", + "agg.update({\"impot_negatif\":\"sum\",\"revenus_positifs\":\"sum\",\"revenus_act_positifs\":\"sum\",\"revenus_remp_positifs\":\"sum\",\"revenus_fon_cap_positifs\":\"sum\",\"prestations_positives\":\"sum\",\"ni_impot_ni_presta\":\"sum\"})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# agg = {f\"{rev}\":\"max\" for rev in revenus + rev_tot + prelevements}\n", + "# nb_max = menages.groupby([\"dixieme\"]).agg(agg).reset_index()\n", + "# nb_max.rename(columns = {rev:f\"{rev}_max\" for rev in nb_max.columns if rev != \"dixieme\"}, inplace = True)\n", + "# agg = {f\"{rev}\":\"sum\" for rev in revenus + rev_tot + prelevements}\n", + "# nb = menages.groupby([\"dixieme\"]).agg(agg).reset_index()\n", + "# nb = pd.merge(nb_max,nb,on = \"dixieme\")\n", + "# for rev in revenus + rev_tot + prelevements:\n", + "# nb[f\"{rev}_part_max\"] = nb[f\"{rev}_max\"] / nb[f\"{rev}\"]\n", + "# nb.to_csv(f\"{output_path}/check_part_max_nb_revenus.csv\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "nb = menages.groupby([\"dixieme\"]).agg(agg).reset_index()\n", + "nb.to_csv(f\"{output_path}/nb_revenus.csv\")\n", + "for rev in revenus + rev_tot + prelevements:\n", + " nb[f\"{rev}_prop\"] = nb[f\"{rev}_pond\"] / nb[\"revenus_pond\"]\n", + " nb[f\"{rev}_moy\"] = nb[f\"{rev}_pond\"] / nb[\"wprm\"]\n", + " nb[f\"{rev}_uc_prop\"] = nb[f\"{rev}_uc_pond\"] / nb[\"revenus_uc_pond\"]\n", + " nb[f\"{rev}_uc_moy\"] = nb[f\"{rev}_uc_pond\"] / nb[\"wprm\"]\n", + "nb[\"prestations_positives_prop\"] = nb[\"prestations_positives\"] / nb[\"wprm\"]\n", + "nb[\"revenus_positifs_prop\"] = nb[\"revenus_positifs\"] / nb[\"wprm\"]\n", + "nb[\"revenus_act_positifs_prop\"] = nb[\"revenus_act_positifs\"] / nb[\"wprm\"]\n", + "nb[\"revenus_remp_positifs_prop\"] = nb[\"revenus_remp_positifs\"] / nb[\"wprm\"]\n", + "nb[\"revenus_fon_cap_positifs_prop\"] = nb[\"revenus_fon_cap_positifs\"] / nb[\"wprm\"]\n", + "nb[\"impot_negatif_prop\"] = nb[\"impot_negatif\"] / nb[\"wprm\"]\n", + "nb[\"ni_impot_ni_presta_prop\"] = nb[\"ni_impot_ni_presta\"] / nb[\"wprm\"]\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "fig.add_trace(\n", + " go.Line(\n", + " x = nb.dixieme,\n", + " y = nb[\"revdecm_uc_moy\"],\n", + " name = \"revdecm_uc_moy\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Line(\n", + " x = nb.dixieme,\n", + " y = nb[\"revdispm_uc_moy\"],\n", + " name = \"revdispm_uc_moy\",\n", + " )\n", + ")\n", + "#fig.update_layout(title = \"Part des menages en fonction de leur statut d'occupation du logement\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "for rev in revenus:\n", + " fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[f\"{rev}_prop\"],\n", + " name = rev,\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Part des différentes catégories de revenus par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()\n", + "fig = go.Figure()\n", + "for rev in revenus:\n", + " fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[f\"{rev}_uc_prop\"],\n", + " name = rev,\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Part des différentes catégories de revenus par uc par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "for rev in [\"prestations_positives_prop\", \"impot_negatif_prop\", \"ni_impot_ni_presta_prop\",\"revenus_positifs_prop\",\"revenus_act_positifs_prop\",\"revenus_remp_positifs_prop\",\"revenus_fon_cap_positifs_prop\"]:\n", + " fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[f\"{rev}\"],\n", + " name = rev,\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Part des personnes payant des impots, recevant des prestations sociales ou aucun des deux par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "#for rev in [\"prestations_positives_prop\", \"impot_negatif_prop\", \"ni_impot_ni_presta_prop\"]:\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"prestations_uc_pond\"] / nb[\"prestations_positives\"],\n", + " name = \"Montant moyen de prestation\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"impots_uc_pond\"] / nb[\"impot_negatif\"],\n", + " name = \"Montant moyen d'impot\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"revenus_activite_uc_pond\"] / nb[\"revenus_act_positifs\"],\n", + " name = \"Montant moyen de revenus d'activité\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"revenus_remplacement_uc_pond\"] / nb[\"revenus_remp_positifs\"],\n", + " name = \"Montant moyen de revenus de remplacement\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"revenus_foncier_capital_uc_pond\"] / nb[\"revenus_fon_cap_positifs\"],\n", + " name = \"Montant moyen de revenus fonciers et du capital\",\n", + " )\n", + ")\n", + "fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[\"revenus_uc_pond\"] / nb[\"revenus_positifs\"],\n", + " name = \"Montant moyen de revenus\",\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Part des personnes payant des impots, recevant des prestations sociales ou aucun des deux par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "fig = go.Figure()\n", + "for rev in [\"revenus\",\"prestations\",\"revenus_activite\",\"revenus_remplacement\"]:\n", + " fig.add_trace(\n", + " go.Bar(\n", + " x = nb.dixieme,\n", + " y = nb[f\"{rev}_uc_moy\"],\n", + " name = rev,\n", + " )\n", + ")\n", + "fig.update_layout(title = \"Montants moyens de revenus imposables et de prestations par dixième de niveau de vie\", bargap = 0.2)\n", + "fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Analyse par dixième " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"acteu5pr\"] = menages.acteu5pr.map({\"1\":\"1\", \"2\":\"1\",\"3\":\"2\",\"4\":\"3\",\"5\":\"2\"})\n", + "menages[\"acteu5cj\"] = menages.acteu5cj.map({\"1\":\"1\", \"2\":\"1\",\"3\":\"2\",\"4\":\"3\",\"5\":\"2\"})\n", + "menages[\"acteu5pr_lab\"] = menages.acteu5pr.map({\"1\":\"en emploi\", \"2\":\"sans emploi\",\"3\":\"retraité\"})\n", + "menages[\"acteu5cj_lab\"] = menages.acteu5cj.map({\"1\":\"en emploi\", \"2\":\"sans emploi\",\"3\":\"retraité\"})\n", + "menages[\"categ_logmnt_lab\"] = np.where(menages[\"categ_logmnt_lab\"] == \"Autre\", 'Propriétaire',menages[\"categ_logmnt_lab\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "test = menages.groupby([\"dixieme\",\"TYPMEN5_lab\",\"acteu5pr_lab\"]).agg({\"revenus_uc_pond\":\"sum\",\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index().sort_values([\"dixieme\",\"TYPMEN5_lab\", \"wprm\"])\n", + "test_check = menages.groupby([\"dixieme\",\"TYPMEN5_lab\",\"acteu5pr_lab\"]).agg({\"revenus_uc_pond\":\"max\"}).reset_index()\n", + "test_check.rename(columns = {\"revenus_uc_pond\":\"revenus_uc_max\"}, inplace = True)\n", + "test = pd.merge(test_check,test, on = [\"dixieme\",\"TYPMEN5_lab\",\"acteu5pr_lab\"])\n", + "test[\"check_poids_max\"] = test[\"revenus_uc_max\"] / test[\"revenus_uc_pond\"]\n", + "test[\"revenus_uc_moy\"] = test.revenus_uc_pond / test.wprm\n", + "test = test.loc[test[\"TYPMEN5_lab\"]!= \"autre / n.a\"]\n", + "test.rename(columns = {'ident21':'count'},inplace = True)\n", + "test = test.loc[test[\"wprm\"] > 200000]\n", + "test.to_csv(f\"{output_path}/check_cas_majoritaire_dixieme.csv\")\n", + "test = test.drop(columns = [\"check_poids_max\", \"revenus_uc_max\"])\n", + "test.to_csv(f\"{output_path}/cas_majoritaire_dixieme.csv\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# SMIC net 2021 après csg et crds, source série chornologique INSEE, pour 35h de travail \n", + "smic = 9 * 1230.6 + 3 * 1258.22\n", + "smic" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "menages[\"part_rev_decl_pond\"] = menages.part_rev_decl * menages.wprm" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_moy(data, group_var):\n", + " moy = data.groupby(group_var).agg({\"ident21\":\"count\",\"wprm\":\"sum\",\"revenus_pond\":\"sum\",\"prestations_pond\":\"sum\",\"agprl_pond\":\"sum\",\"revenus_remplacement_pond\":\"sum\",\"revenus_activite_pond\":\"sum\",\"revenus_foncier_capital_pond\":\"sum\",\"part_rev_decl_pond\":\"sum\"})\n", + " moy.rename(columns={\"ident21\":\"count\"},inplace = True)\n", + " moy[\"revenus_moy\"] = moy.revenus_pond / moy.wprm\n", + " moy[\"revenus_remplacement_moy\"] = moy.revenus_remplacement_pond / moy.wprm\n", + " moy[\"revenus_activite_moy\"] = moy.revenus_activite_pond / moy.wprm\n", + " moy[\"revenus_fon_cap_moy\"] = moy.revenus_foncier_capital_pond / moy.wprm\n", + " moy[\"prestations_moy\"] = moy.prestations_pond / moy.wprm\n", + " moy[\"age_moy\"] = moy.agprl_pond / moy.wprm\n", + " #moy[\"part_rev_decl_moy\"] = moy.part_rev_decl_pond / moy.wprm\n", + " moy[\"rev_pourc_smic\"] = moy.revenus_moy / smic\n", + " moy = moy.drop([\"revenus_pond\",\"prestations_pond\",\"agprl_pond\",\"revenus_remplacement_pond\",\"revenus_activite_pond\",\"revenus_foncier_capital_pond\",\"part_rev_decl_pond\"], axis = 1)\n", + " return moy" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_logmnt(data,group_var):\n", + " nb_logtm = data.groupby([group_var, \"categ_logmnt_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + " nb_logtm.rename(columns={\"ident21\":\"count\"},inplace = True)\n", + " nb_logtm[\"prop\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(group_var)['wprm'].transform(\"sum\"))\n", + " nb_logtm[\"distrib\"] = round(100 * nb_logtm.wprm /nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].transform(\"sum\"))\n", + " nb_logtm.groupby(\"categ_logmnt_lab\")['wprm'].agg(\"sum\")\n", + " print(nb_logtm)\n", + " fig = go.Figure()\n", + " fig = px.histogram(nb_logtm,\n", + " x = group_var,\n", + " y = \"prop\",\n", + " #barmode=\"group\",\n", + " color = \"categ_logmnt_lab\",\n", + " text_auto = True,\n", + " nbins = 5\n", + " )\n", + " fig.update_layout(title = \"Part des menages en fonction de leur statut d'occupation du logement\", bargap = 0.2)\n", + " fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def analyse_personne_seule(data):\n", + " print(\"Répartition des statut d'activité de la personne : \")\n", + " print(100*data.groupby('acteu5pr_lab').agg({\"wprm\":\"sum\"})/data.wprm.sum())\n", + "\n", + " moy = compute_moy(data, \"acteu5pr_lab\")\n", + " print(\"Moyenne des revenus par catégorie d'actitivité : \")\n", + " print(moy)\n", + "\n", + " compute_logmnt(data, \"acteu5pr_lab\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_statut_couple(data):\n", + " nb = data.groupby([\"acteu5pr_lab\", \"acteu5cj_lab\"]).agg({\"wprm\":\"sum\",\"ident21\":\"count\"}).reset_index()\n", + " nb.rename(columns = {\"ident21\":\"count\"})\n", + " nb[\"prop\"] = round(100 * nb.wprm /nb.groupby(\"acteu5pr_lab\")['wprm'].transform(\"sum\"))\n", + " nb[\"distrib\"] = round(100 * nb.wprm /nb.groupby(\"acteu5cj_lab\")['wprm'].transform(\"sum\"))\n", + " nb.groupby(\"acteu5cj_lab\")['wprm'].agg(\"sum\")\n", + " print(nb)\n", + " fig = go.Figure()\n", + " fig = px.histogram(nb,\n", + " x = \"acteu5pr_lab\",\n", + " y = \"prop\",\n", + " #barmode=\"acteu5cj\",\n", + " color = \"acteu5cj_lab\",\n", + " text_auto = True,\n", + " nbins = 5\n", + " )\n", + " fig.update_layout(title = \"Part des menages en fonction de leur statut d'activité\", bargap = 0.2)\n", + " fig.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def analyse_couple(data):\n", + " print(\"Statut activité adulte 1\")\n", + " print(100*data.groupby('acteu5pr_lab').agg({\"wprm\":\"sum\"})/data.wprm.sum())\n", + " print(\"Statut activité adulte 2\")\n", + " print(100*data.groupby('acteu5cj_lab').agg({\"wprm\":\"sum\"})/data.wprm.sum())\n", + " compute_statut_couple(data)\n", + " print(\"Nombre d'apporteur de ressources du ménage\")\n", + " #temp = data.groupby('nbres').agg({\"wprm\":\"sum\",\"part_rev_decl_pond\":\"sum\"})\n", + " #temp[\"part_rev_decl_moy\"] = 100*temp.part_rev_decl_pond / temp.wprm\n", + " temp = data.groupby('nbres').agg({\"wprm\":\"sum\"}).reset_index()\n", + " temp[\"wprm\"] = 100 * temp.wprm/data.wprm.sum()\n", + " #print(temp[[\"wprm\",\"part_rev_decl_moy\"]])\n", + " print(temp.loc[temp['nbres'] < 3][[\"wprm\"]])\n", + " moy = compute_moy(data, \"acteu5pr_lab\")\n", + " print(\"Moyenne des revenus par catégorie d'actitivité de l'adulte 1 : \")\n", + " print(moy)\n", + " compute_logmnt(data, \"acteu5pr_lab\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def analyse_quantile(quantile):\n", + " print(f\" \\n __________________ QUANTILE {quantile} ____________________\")\n", + "\n", + " print(\" \\n ***** Personne seule ***** \\n\")\n", + " focus_type = focus.loc[focus[\"TYPMEN5\"] == \"1\"]\n", + " if quantile >= 5:\n", + " focus_type = focus_type.loc[focus.acteu5pr != \"2\"] # on enlève les sans emploi dans le haut de la distribution car pas assez de monde\n", + " analyse_personne_seule(focus_type)\n", + " #menages = menages.loc[menages[\"TYPMEN5\"] != \"5\"]\n", + " print(\" \\n ***** Couple sans enfant ***** \\n\")\n", + " focus_type = focus.loc[focus[\"TYPMEN5\"] == \"3\"]\n", + " analyse_couple(focus_type)\n", + " print(\" \\n ***** Couple avec enfant(s) ***** \\n\")\n", + " focus_type = focus.loc[focus[\"TYPMEN5\"] == \"4\"]\n", + " focus_type['acteu5pr_lab'] = np.where(focus_type['acteu5pr_lab'] == \"retraité\",\"sans emploi\",focus_type['acteu5pr_lab'])\n", + " focus_type['acteu5cj_lab'] = np.where(focus_type['acteu5cj_lab'] == \"retraité\",\"sans emploi\",focus_type['acteu5cj_lab'])\n", + " analyse_couple(focus_type)\n", + "\n", + " if quantile < 4:\n", + " print(\" \\n ***** Famille monoparentale ***** \\n\")\n", + " focus_type = focus.loc[focus[\"TYPMEN5\"] == \"2\"]\n", + " focus_type['acteu5pr_lab'] = np.where(focus_type['acteu5pr_lab'] == \"retraité\",\"sans emploi\",focus_type['acteu5pr_lab'])\n", + " analyse_personne_seule(focus_type)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for i in range(1,2):\n", + " analyse_quantile(i)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for quantile in range(1,11):\n", + " analyse_quantile(quantile)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "leximpact-prepare-data-kernel", + "language": "python", + "name": "leximpact-prepare-data-kernel" + }, + "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.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}