Observatoire des loyers

Remarque

Ce jeu de données a un gros défaut: les statistiques au niveau des communes (ou des arrondissements) sont disponible que sur https://www.observatoires-des-loyers.org/ mais ont été retirées des fichiers CSV...

Récupération des données

In [1]:
%matplotlib inline
#%matplotlib notebook

import matplotlib
matplotlib.rcParams['figure.figsize'] = (9, 9)

import pandas as pd
In [2]:
url = "https://www.data.gouv.fr/fr/datasets/r/1fee314d-c278-424f-a029-a74d877eb185"
df2016 = pd.read_csv(url,
                     encoding='iso-8859-1',
                     sep=';',
                     decimal=',')
In [3]:
url = "https://www.data.gouv.fr/fr/datasets/r/15d902ed-4dc3-457d-9c5d-bfe1151cb573"
df2015 = pd.read_csv(url,
                     encoding='iso-8859-1',
                     sep=';',
                     decimal=',')
In [4]:
url = "https://www.data.gouv.fr/fr/datasets/r/42aaf838-46c9-4434-95a9-00173c6d4627"
df2014 = pd.read_csv(url,
                     encoding='iso-8859-1',
                     sep=';', 
                     decimal=',')
In [5]:
frames = [df2014, df2015, df2016]
df = pd.concat(frames, ignore_index=True)

Informations utiles sur les données

In [6]:
df.shape
Out[6]:
(13270, 25)
In [7]:
df.columns
Out[7]:
Index(['Data_year', 'Observatory', 'Type_habitat', 'Zone_complementaire',
       'agglomeration', 'anciennete_locataire_homogene',
       'epoque_construction_homogene', 'loyer_1_decile', 'loyer_1_quartile',
       'loyer_3_quartile', 'loyer_9_decile', 'loyer_median',
       'loyer_mensuel_1_decile', 'loyer_mensuel_1_quartile',
       'loyer_mensuel_3_quartile', 'loyer_mensuel_9_decile',
       'loyer_mensuel_median', 'loyer_moyen', 'methodologie_production',
       'moyenne_loyer_mensuel', 'nombre_logements', 'nombre_observations',
       'nombre_obsservations', 'nombre_pieces_homogene', 'surface_moyenne'],
      dtype='object')

Données par agglomération

In [8]:
#df.Observatory.value_counts().plot.barh()
In [9]:
df.agglomeration.value_counts().plot.barh()
Out[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x10f50b828>

Paris intra-muros

In [10]:
dfp = df[df.agglomeration == "Paris intra-muros"]
In [11]:
fig, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, figsize=(10, 5))

dfp[dfp.Data_year == 2014].Type_habitat.value_counts().plot.pie(y="Type_habitat", ax=ax1)
dfp[dfp.Data_year == 2015].Type_habitat.value_counts().plot.pie(y="Type_habitat", ax=ax2)
#dfp[dfp.Data_year == 2016].Type_habitat.value_counts().plot.pie(y="Type_habitat", ax=ax3)
Out[11]:
<matplotlib.axes._subplots.AxesSubplot at 0x10f96aa20>
In [12]:
dfp[dfp.Data_year == 2014].plot.scatter(x="moyenne_loyer_mensuel",
                                        y="surface_moyenne",
                                        s=dfp[dfp.Data_year == 2014].nombre_obsservations,
                                        alpha=0.1)
Out[12]:
<matplotlib.axes._subplots.AxesSubplot at 0x1128cf860>
In [13]:
dfp[dfp.Data_year == 2015].plot.scatter(x="moyenne_loyer_mensuel",
                                        y="surface_moyenne",
                                        #s=dfp[dfp.Data_year == 2015].nombre_obsservations,
                                        #c="blue",
                                        alpha=0.5)
Out[13]:
<matplotlib.axes._subplots.AxesSubplot at 0x1128efc88>

Remarque: pourquoi cette grosse différence avec l'année précédente ?

Région Parisienne

In [14]:
dfp = df[df.agglomeration == "Agglomération parisienne"]
In [15]:
fig, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, figsize=(10, 5))

dfp[dfp.Data_year == 2014].Type_habitat.value_counts().plot.pie(y="Type_habitat", ax=ax1)
dfp[dfp.Data_year == 2015].Type_habitat.value_counts().plot.pie(y="Type_habitat", ax=ax2)
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x112abe908>
In [16]:
dfp[dfp.Data_year == 2014].plot.scatter(x="moyenne_loyer_mensuel",
                                        y="surface_moyenne",
                                        #c=dfp[dfp.Data_year == 2014].nombre_obsservations,
                                        alpha=0.5)
                                        #cmap="Blues")
Out[16]:
<matplotlib.axes._subplots.AxesSubplot at 0x112a7f2b0>
In [17]:
dfp[dfp.Data_year == 2015].plot.scatter(x="moyenne_loyer_mensuel",
                                        y="surface_moyenne",
                                        #s=dfp[dfp.Data_year == 2015].nombre_obsservations,
                                        #c="blue",
                                        alpha=0.5)
Out[17]:
<matplotlib.axes._subplots.AxesSubplot at 0x112c00358>

Région Parisienne

In [18]:
dfp = df[df.agglomeration == "Agglomération parisienne (hors Paris)"]
In [19]:
fig, (ax1, ax2) = plt.subplots(ncols=2, nrows=1, figsize=(10, 5))

dfp[dfp.Data_year == 2014].Type_habitat.value_counts().plot.pie(y="Type_habitat", ax=ax1)
dfp[dfp.Data_year == 2015].Type_habitat.value_counts().plot.pie(y="Type_habitat", ax=ax2)
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x112f51a20>
In [20]:
dfp[dfp.Data_year == 2014].plot.scatter(x="moyenne_loyer_mensuel",
                                        y="surface_moyenne",
                                        #c=dfp[dfp.Data_year == 2014].nombre_obsservations,
                                        alpha=0.5)
                                        #cmap="Blues")
Out[20]:
<matplotlib.axes._subplots.AxesSubplot at 0x112a06f60>
In [21]:
dfp[dfp.Data_year == 2015].plot.scatter(x="moyenne_loyer_mensuel",
                                        y="surface_moyenne",
                                        #s=dfp[dfp.Data_year == 2015].nombre_obsservations,
                                        #c="blue",
                                        alpha=0.5)
Out[21]:
<matplotlib.axes._subplots.AxesSubplot at 0x1130a8c88>