In [1]:
import pandas as pd
import numpy as np

Evolution d'indicateurs dans les communes :

Chargement de nos données :


In [2]:
commune_metropole = pd.read_csv('data/commune_metropole.csv', encoding='utf-8')

In [3]:
commune_metropole.shape


Out[3]:
(36742, 6)

In [4]:
commune_metropole.head()


Out[4]:
COM status mean_altitude superficie is_metropole metropole_name
0 39007 Commune simple 587.0 582.0 0 NaN
1 88086 Commune simple 454.0 396.0 0 NaN
2 62627 Commune simple 49.0 426.0 0 NaN
3 14020 Commune simple 33.0 987.0 0 NaN
4 11091 Chef-lieu canton 455.0 1605.0 0 NaN

In [5]:
insee = pd.read_csv('data/insee.csv',
                    sep=";",                       # séparateur du fichier
                    dtype={'COM' : np.dtype(str)}, # On force la colonne COM est être en string
                    encoding='utf-8')              # encoding


/Users/babou/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py:2723: DtypeWarning: Columns (0,5,6,7,9,337,339,340) have mixed types. Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)

In [16]:
insee.shape


Out[16]:
(51981, 692)

In [7]:
insee.info()


<class 'pandas.core.frame.DataFrame'>
RangeIndex: 51981 entries, 0 to 51980
Columns: 692 entries, CODGEO to C11_ACTOCC15P_TCOM
dtypes: float64(679), object(13)
memory usage: 274.4+ MB

In [8]:
insee.head()


Out[8]:
CODGEO LIBGEO COM LIBCOM REG DEP ARR CV ZE2010 UU2010 ... P11_ACTOCC15P_ILT2 P11_ACTOCC15P_ILT3 P11_ACTOCC15P_ILT4 P11_ACTOCC15P_ILT5 C11_ACTOCC15P C11_ACTOCC15P_PAS C11_ACTOCC15P_MAR C11_ACTOCC15P_DROU C11_ACTOCC15P_VOIT C11_ACTOCC15P_TCOM
0 010040101 Les Perouses-Triangle d'Activite 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 ... 317.015247 85.142183 3.972496 0.986260 816.118325 59.941594 173.567770 33.115152 431.021547 118.472261
1 010040102 Longeray-Gare 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 ... 541.398079 262.972521 0.000000 4.049623 1454.479926 47.145285 138.532496 32.485088 999.106567 237.210489
2 010040201 Centre-St Germain-Vareilles 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 ... 653.198369 284.638617 16.880896 1.044646 1586.163074 35.384669 147.459541 49.214136 1170.717345 183.387384
3 010040202 Tiret-Les Allymes 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 ... 824.964223 373.518373 50.083795 6.787649 2021.119521 58.080086 37.693265 58.277088 1548.451984 318.617098
4 01004ZZZZ non localisé à l'iris 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

5 rows × 692 columns


In [12]:
pd.set_option('display.max_columns', 30) # Changer le nombre de colonnnes afficher dans le notebook

In [13]:
insee.head()


Out[13]:
CODGEO LIBGEO COM LIBCOM REG DEP ARR CV ZE2010 UU2010 NB_B101 NB_B102 NB_B103 NB_B201 NB_B202 ... P11_NSAL15P_INDEP P11_NSAL15P_EMPLOY P11_NSAL15P_AIDFAM P11_ACTOCC15P_ILT1 P11_ACTOCC15P_ILT2P P11_ACTOCC15P_ILT2 P11_ACTOCC15P_ILT3 P11_ACTOCC15P_ILT4 P11_ACTOCC15P_ILT5 C11_ACTOCC15P C11_ACTOCC15P_PAS C11_ACTOCC15P_MAR C11_ACTOCC15P_DROU C11_ACTOCC15P_VOIT C11_ACTOCC15P_TCOM
0 010040101 Les Perouses-Triangle d'Activite 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 2.0 3.0 1.0 1.0 ... 19.156504 21.212709 0.999988 402.002223 407.116185 317.015247 85.142183 3.972496 0.986260 816.118325 59.941594 173.567770 33.115152 431.021547 118.472261
1 010040102 Longeray-Gare 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 2.0 0.0 0.0 2.0 ... 46.641016 44.765844 4.989538 646.059703 808.420222 541.398079 262.972521 0.000000 4.049623 1454.479926 47.145285 138.532496 32.485088 999.106567 237.210489
2 010040201 Centre-St Germain-Vareilles 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 0.0 0.0 0.0 1.0 ... 28.642259 34.495942 1.044646 627.445239 955.762529 653.198369 284.638617 16.880896 1.044646 1586.163074 35.384669 147.459541 49.214136 1170.717345 183.387384
3 010040202 Tiret-Les Allymes 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 1.0 0.0 0.0 2.0 ... 112.254482 125.790450 0.000000 771.765410 1255.354039 824.964223 373.518373 50.083795 6.787649 2021.119521 58.080086 37.693265 58.277088 1548.451984 318.617098
4 01004ZZZZ non localisé à l'iris 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 0.0 0.0 0.0 0.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

5 rows × 692 columns

Jointure entre 2 fichiers :


In [14]:
data = insee.merge(commune_metropole, on='COM', how='left')

In [15]:
data.shape


Out[15]:
(51981, 697)

In [17]:
data.head()


Out[17]:
CODGEO LIBGEO COM LIBCOM REG DEP ARR CV ZE2010 UU2010 NB_B101 NB_B102 NB_B103 NB_B201 NB_B202 ... P11_ACTOCC15P_ILT2 P11_ACTOCC15P_ILT3 P11_ACTOCC15P_ILT4 P11_ACTOCC15P_ILT5 C11_ACTOCC15P C11_ACTOCC15P_PAS C11_ACTOCC15P_MAR C11_ACTOCC15P_DROU C11_ACTOCC15P_VOIT C11_ACTOCC15P_TCOM status mean_altitude superficie is_metropole metropole_name
0 010040101 Les Perouses-Triangle d'Activite 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 2.0 3.0 1.0 1.0 ... 317.015247 85.142183 3.972496 0.986260 816.118325 59.941594 173.567770 33.115152 431.021547 118.472261 Chef-lieu canton 379.0 2448.0 0.0 NaN
1 010040102 Longeray-Gare 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 2.0 0.0 0.0 2.0 ... 541.398079 262.972521 0.000000 4.049623 1454.479926 47.145285 138.532496 32.485088 999.106567 237.210489 Chef-lieu canton 379.0 2448.0 0.0 NaN
2 010040201 Centre-St Germain-Vareilles 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 0.0 0.0 0.0 1.0 ... 653.198369 284.638617 16.880896 1.044646 1586.163074 35.384669 147.459541 49.214136 1170.717345 183.387384 Chef-lieu canton 379.0 2448.0 0.0 NaN
3 010040202 Tiret-Les Allymes 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 1.0 0.0 0.0 2.0 ... 824.964223 373.518373 50.083795 6.787649 2021.119521 58.080086 37.693265 58.277088 1548.451984 318.617098 Chef-lieu canton 379.0 2448.0 0.0 NaN
4 01004ZZZZ non localisé à l'iris 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 0.0 0.0 0.0 0.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Chef-lieu canton 379.0 2448.0 0.0 NaN

5 rows × 697 columns

Il y a bien les colonnes "status", "mean_altitude", "superficie", "is_metropole" et "metropole_name"


In [ ]:


In [ ]:


In [ ]:


In [ ]:

Nombre de personnes qui utilisent la voiture pour aller travailler en métropole (pourcentage) :


In [18]:
# Clefs pour regrouper par ville 
key = ['CODGEO',
        'LIBGEO',
        'COM',
        'LIBCOM',
        'REG',
        'DEP',
        'ARR',
        'CV',
        'ZE2010',
        'UU2010',
        'TRIRIS',
        'REG2016',
        'status_rank']
#        'is_metropole']

In [19]:
# Autres valeurs 
features = [col for col in data.columns if col not in key]
# Nom des colonnes qui ne sont pas dans les colonnes de key

In [24]:
len(features)


Out[24]:
686

In [26]:
# On cherche à regrouper nos données sur le nom de la métropole :
# On somme tous nos indicateurs
metropole_sum = data[features][data.is_metropole == 1].groupby('metropole_name').sum().reset_index()
metropole_sum.shape


Out[26]:
(11, 681)

In [27]:
metropole_sum


Out[27]:
metropole_name NB_B101 NB_B102 NB_B103 NB_B201 NB_B202 NB_B203 NB_B204 NB_B205 NB_B206 NB_B301 NB_B302 NB_B303 NB_B304 NB_B305 ... P11_ACTOCC15P_ILT1 P11_ACTOCC15P_ILT2P P11_ACTOCC15P_ILT2 P11_ACTOCC15P_ILT3 P11_ACTOCC15P_ILT4 P11_ACTOCC15P_ILT5 C11_ACTOCC15P C11_ACTOCC15P_PAS C11_ACTOCC15P_MAR C11_ACTOCC15P_DROU C11_ACTOCC15P_VOIT C11_ACTOCC15P_TCOM mean_altitude superficie is_metropole
0 Bordeaux 18.0 89.0 42.0 44.0 217.0 385.0 169.0 17.0 26.0 240.0 872.0 179.0 161.0 88.0 ... 114415.506688 197956.181422 188900.211935 1978.190841 6705.649500 372.129146 312403.375196 8980.094272 20168.183563 23413.265565 207506.371166 52335.460630 6794.0 968340.0 293.0
1 Brest 8.0 29.0 6.0 8.0 29.0 97.0 44.0 8.0 16.0 38.0 233.0 40.0 43.0 24.0 ... 46967.899268 36314.164738 34213.557713 653.808831 1295.614679 151.183515 83115.132608 2444.226455 6259.133992 3374.831895 61762.076746 9274.863519 5792.0 412218.0 98.0
2 Grenoble 6.0 33.0 12.0 37.0 106.0 192.0 91.0 6.0 8.0 132.0 446.0 88.0 71.0 43.0 ... 63026.648459 123003.323177 116908.973570 3810.728607 1944.294177 339.326822 186226.316132 5747.859744 16024.914943 15027.973762 112880.782653 36544.785029 73562.0 272420.0 210.0
3 Lille 23.0 148.0 33.0 63.0 376.0 493.0 264.0 25.0 14.0 165.0 1095.0 190.0 191.0 107.0 ... 126472.864052 313544.467814 278993.507976 12688.358214 9078.618739 12783.982885 440154.190826 13147.306767 32227.166588 16469.060799 302677.703395 75632.953278 15422.0 830600.0 531.0
4 Montpellier 7.0 39.0 9.0 26.0 179.0 215.0 118.0 8.0 21.0 89.0 453.0 83.0 86.0 41.0 ... 89505.679297 77990.668938 69448.798732 4057.533299 4082.585543 401.751364 166865.650206 5265.762856 13378.903026 12203.400491 112637.282501 23380.301333 7819.0 622827.0 163.0
5 Nantes 15.0 61.0 31.0 18.0 96.0 280.0 109.0 15.0 26.0 151.0 594.0 118.0 125.0 54.0 ... 108795.743831 147898.264955 135966.768532 5563.132289 6070.454060 297.910074 256599.398596 8076.403341 15040.717889 14833.006860 167552.014965 51097.255541 5923.0 1026079.0 245.0
6 Nice 9.0 60.0 33.0 61.0 347.0 394.0 204.0 25.0 38.0 188.0 881.0 155.0 156.0 94.0 ... 125913.717818 87796.325886 72696.391754 1248.951152 2348.964226 11502.018754 213877.956365 8366.709859 23808.833125 19037.032818 125035.820113 37629.560450 64199.0 1310251.0 242.0
7 Rennes 8.0 32.0 16.0 24.0 57.0 164.0 55.0 10.0 6.0 103.0 409.0 72.0 75.0 41.0 ... 73101.376972 107200.625766 99268.703581 2391.491816 5361.075883 179.354486 180073.037221 6040.488391 13178.213030 9699.410215 118196.572269 32958.353317 7936.0 641787.0 179.0
8 Rouen 7.0 50.0 10.0 20.0 131.0 218.0 118.0 9.0 12.0 103.0 496.0 88.0 86.0 49.0 ... 54891.793000 140019.460285 120762.987836 11122.253716 7957.445768 176.772965 195231.552483 6096.327848 16904.492410 6314.535321 136860.989128 29055.207775 15206.0 312235.0 253.0
9 Strasbourg 9.0 53.0 4.0 21.0 156.0 242.0 65.0 11.0 2.0 97.0 516.0 107.0 95.0 43.0 ... 96581.813239 98231.272041 88750.944438 2387.655397 3544.244538 3548.427667 194966.498935 6167.938155 16636.791930 19771.046727 110145.294190 42245.427933 27742.0 989336.0 197.0
10 Toulouse 12.0 84.0 30.0 79.0 196.0 339.0 211.0 19.0 37.0 218.0 809.0 146.0 160.0 74.0 ... 168867.768664 149629.648617 134901.776119 6462.215918 7781.108380 484.548199 318257.258114 8635.760989 20689.913792 21289.728101 208920.689602 58721.165631 40037.0 1958347.0 262.0

11 rows × 681 columns


In [28]:
voiture_colonnes = ['metropole_name' , 'C11_ACTOCC15P_VOIT', 'P11_ACTOCC15P']

In [29]:
voiture = metropole_sum[voiture_colonnes].copy()
voiture


Out[29]:
metropole_name C11_ACTOCC15P_VOIT P11_ACTOCC15P
0 Bordeaux 207506.371166 312371.688110
1 Brest 61762.076746 83282.064006
2 Grenoble 112880.782653 186029.971637
3 Lille 302677.703395 440017.331865
4 Montpellier 112637.282501 167496.348235
5 Nantes 167552.014965 256694.008786
6 Nice 125035.820113 213710.043704
7 Rennes 118196.572269 180302.002739
8 Rouen 136860.989128 194911.253285
9 Strasbourg 110145.294190 194813.085280
10 Toulouse 208920.689602 318497.417281

Il va falloir re-travailler la données pour pouvoir donner le pourcentage de personnes qui prenne la voiture en 2011 / 2012 ainsi qu'avoir la progression


In [30]:
#voiture['pourcentage_car_11'] = (voiture["C11_ACTOCC15P_VOIT"] / voiture["P11_ACTOCC15P"])*100

In [31]:
#voiture


Out[31]:
metropole_name C11_ACTOCC15P_VOIT P11_ACTOCC15P pourcentage_car_11
0 Bordeaux 207506.371166 312371.688110 66.429315
1 Brest 61762.076746 83282.064006 74.160118
2 Grenoble 112880.782653 186029.971637 60.678815
3 Lille 302677.703395 440017.331865 68.787678
4 Montpellier 112637.282501 167496.348235 67.247605
5 Nantes 167552.014965 256694.008786 65.273052
6 Nice 125035.820113 213710.043704 58.507227
7 Rennes 118196.572269 180302.002739 65.554775
8 Rouen 136860.989128 194911.253285 70.217079
9 Strasbourg 110145.294190 194813.085280 56.538961
10 Toulouse 208920.689602 318497.417281 65.595725

In [33]:
#voiture['pourcentage_car_12'] = (voiture["C12_ACTOCC15P_VOIT"] / voiture["P12_ACTOCC15P"])*100
#voiture

Calculer une augmentation :


In [34]:
def augmentation(depart, arrive):
    """
    Calcul de l'augmentation entre 2 valeurs :
    # ( ( valeur d'arrivée - valeur de départ ) / valeur de départ ) x 100
    """
    return ((arrive - depart) / depart) * 100

In [35]:
voiture['augmentation'] = augmentation(voiture['pourcentage_car_11'], voiture['pourcentage_car_12'])

In [36]:
# Les métropole qui utilise le moins la voiture pour aller travailler :
voiture.sort_values('augmentation')


Out[36]:
metropole_name C12_ACTOCC15P_VOIT C11_ACTOCC15P_VOIT P12_ACTOCC15P P11_ACTOCC15P pourcentage_car_11 pourcentage_car_12 augmentation
10 Toulouse 209807.637776 208920.689602 322379.008362 318497.417281 65.595725 65.081048 -0.784619
7 Rennes 118397.871923 118196.572269 181838.467426 180302.002739 65.554775 65.111565 -0.676091
1 Brest 61279.056005 61762.076746 83156.388709 83282.064006 74.160118 73.691339 -0.632118
0 Bordeaux 208231.699409 207506.371166 315256.899143 312371.688110 66.429315 66.051433 -0.568848
9 Strasbourg 109387.756750 110145.294190 194552.345854 194813.085280 56.538961 56.225360 -0.554664
5 Nantes 168483.240321 167552.014965 259371.500676 256694.008786 65.273052 64.958270 -0.482254
2 Grenoble 112178.102149 112880.782653 185738.532132 186029.971637 60.678815 60.395708 -0.466566
6 Nice 124067.371558 125035.820113 213022.822499 213710.043704 58.507227 58.241352 -0.454431
4 Montpellier 113863.952781 112637.282501 169943.126723 167496.348235 67.247605 67.001211 -0.366398
8 Rouen 133840.099577 136860.989128 191125.767932 194911.253285 70.217079 70.027240 -0.270361
3 Lille 302423.675325 302677.703395 440485.598808 440017.331865 68.787678 68.656881 -0.190145

Transport en commun en pourcentage :


In [34]:
transp_com_colonnes = ['metropole_name' , 'C11_ACTOCC15P_TCOM', 'P11_ACTOCC15P']

In [35]:
transp_com = metropole_sum[transp_com_colonnes].copy()
transp_com


Out[35]:
metropole_name C11_ACTOCC15P_TCOM P11_ACTOCC15P
0 Bordeaux 52335.460630 312371.688110
1 Brest 9274.863519 83282.064006
2 Grenoble 36544.785029 186029.971637
3 Lille 75632.953278 440017.331865
4 Montpellier 23380.301333 167496.348235
5 Nantes 51097.255541 256694.008786
6 Nice 37629.560450 213710.043704
7 Rennes 32958.353317 180302.002739
8 Rouen 29055.207775 194911.253285
9 Strasbourg 42245.427933 194813.085280
10 Toulouse 58721.165631 318497.417281

In [36]:
#transp_com['pourcentage_trans_com_12'] = (transp_com["C12_ACTOCC15P_TCOM"] / transp_com["P12_ACTOCC15P"])*100
#transp_com

In [38]:
transp_com['pourcentage_trans_com_11'] = (transp_com["C11_ACTOCC15P_TCOM"] / transp_com["P11_ACTOCC15P"])*100
transp_com.sort_values('pourcentage_trans_com_11')


Out[38]:
metropole_name C11_ACTOCC15P_TCOM P11_ACTOCC15P pourcentage_trans_com_11
1 Brest 9274.863519 83282.064006 11.136688
4 Montpellier 23380.301333 167496.348235 13.958693
8 Rouen 29055.207775 194911.253285 14.906891
0 Bordeaux 52335.460630 312371.688110 16.754227
3 Lille 75632.953278 440017.331865 17.188630
6 Nice 37629.560450 213710.043704 17.607764
7 Rennes 32958.353317 180302.002739 18.279527
10 Toulouse 58721.165631 318497.417281 18.436936
2 Grenoble 36544.785029 186029.971637 19.644568
5 Nantes 51097.255541 256694.008786 19.905901
9 Strasbourg 42245.427933 194813.085280 21.685108

In [41]:
transp_com['augmentation'] = augmentation(transp_com['pourcentage_trans_com_11'], transp_com['pourcentage_trans_com_12'])

In [43]:
transp_com.sort_values('augmentation')


Out[43]:
metropole_name C11_ACTOCC15P_TCOM C12_ACTOCC15P_TCOM P12_ACTOCC15P P11_ACTOCC15P pourcentage_trans_com_12 pourcentage_trans_com_11 augmentation
2 Grenoble 36544.785029 36482.453930 185738.532132 186029.971637 19.641834 19.644568 -0.013920
5 Nantes 51097.255541 51779.165514 259371.500676 256694.008786 19.963321 19.905901 0.288457
7 Rennes 32958.353317 33592.246521 181838.467426 180302.002739 18.473674 18.279527 1.062103
3 Lille 75632.953278 76969.534382 440485.598808 440017.331865 17.473791 17.188630 1.659008
0 Bordeaux 52335.460630 53724.679898 315256.899143 312371.688110 17.041556 16.754227 1.714964
9 Strasbourg 42245.427933 42942.834903 194552.345854 194813.085280 22.072638 21.685108 1.787079
8 Rouen 29055.207775 29094.150099 191125.767932 194911.253285 15.222516 14.906891 2.117309
10 Toulouse 58721.165631 60926.981328 322379.008362 318497.417281 18.899178 18.436936 2.507149
6 Nice 37629.560450 38459.554321 213022.822499 213710.043704 18.054194 17.607764 2.535417
1 Brest 9274.863519 9512.024368 83156.388709 83282.064006 11.438717 11.136688 2.712024
4 Montpellier 23380.301333 24418.320115 169943.126723 167496.348235 14.368525 13.958693 2.936031

Transport vélo :


In [40]:
transp_velo_colonnes = ['metropole_name' , 'C11_ACTOCC15P_DROU', 'P11_ACTOCC15P']

In [42]:
transp_velo = metropole_sum[transp_velo_colonnes].copy()
transp_velo


Out[42]:
metropole_name C11_ACTOCC15P_DROU P11_ACTOCC15P
0 Bordeaux 23413.265565 312371.688110
1 Brest 3374.831895 83282.064006
2 Grenoble 15027.973762 186029.971637
3 Lille 16469.060799 440017.331865
4 Montpellier 12203.400491 167496.348235
5 Nantes 14833.006860 256694.008786
6 Nice 19037.032818 213710.043704
7 Rennes 9699.410215 180302.002739
8 Rouen 6314.535321 194911.253285
9 Strasbourg 19771.046727 194813.085280
10 Toulouse 21289.728101 318497.417281

In [43]:
#transp_velo['pourcentage_trans_com_12'] = (transp_velo["C12_ACTOCC15P_TCOM"] / transp_velo["P12_ACTOCC15P"])*100
#transp_velo

In [45]:
transp_velo['pourcentage_trans_com_11'] = (transp_velo["C11_ACTOCC15P_DROU"] / transp_velo["P11_ACTOCC15P"])*100
transp_velo


Out[45]:
metropole_name C11_ACTOCC15P_DROU P11_ACTOCC15P pourcentage_trans_com_11
0 Bordeaux 23413.265565 312371.688110 7.495323
1 Brest 3374.831895 83282.064006 4.052291
2 Grenoble 15027.973762 186029.971637 8.078254
3 Lille 16469.060799 440017.331865 3.742821
4 Montpellier 12203.400491 167496.348235 7.285771
5 Nantes 14833.006860 256694.008786 5.778478
6 Nice 19037.032818 213710.043704 8.907879
7 Rennes 9699.410215 180302.002739 5.379535
8 Rouen 6314.535321 194911.253285 3.239698
9 Strasbourg 19771.046727 194813.085280 10.148726
10 Toulouse 21289.728101 318497.417281 6.684427

Célib : Age / Uniquement à Bordeaux par Quartier :


In [48]:
data.head()


Out[48]:
CODGEO LIBGEO COM LIBCOM REG DEP ARR CV ZE2010 UU2010 NB_B101 NB_B102 NB_B103 NB_B201 NB_B202 ... P11_ACTOCC15P_ILT2 P11_ACTOCC15P_ILT3 P11_ACTOCC15P_ILT4 P11_ACTOCC15P_ILT5 C11_ACTOCC15P C11_ACTOCC15P_PAS C11_ACTOCC15P_MAR C11_ACTOCC15P_DROU C11_ACTOCC15P_VOIT C11_ACTOCC15P_TCOM status mean_altitude superficie is_metropole metropole_name
0 010040101 Les Perouses-Triangle d'Activite 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 2.0 3.0 1.0 1.0 ... 317.015247 85.142183 3.972496 0.986260 816.118325 59.941594 173.567770 33.115152 431.021547 118.472261 Chef-lieu canton 379.0 2448.0 0.0 NaN
1 010040102 Longeray-Gare 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 2.0 0.0 0.0 2.0 ... 541.398079 262.972521 0.000000 4.049623 1454.479926 47.145285 138.532496 32.485088 999.106567 237.210489 Chef-lieu canton 379.0 2448.0 0.0 NaN
2 010040201 Centre-St Germain-Vareilles 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 0.0 0.0 0.0 1.0 ... 653.198369 284.638617 16.880896 1.044646 1586.163074 35.384669 147.459541 49.214136 1170.717345 183.387384 Chef-lieu canton 379.0 2448.0 0.0 NaN
3 010040202 Tiret-Les Allymes 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 1.0 0.0 0.0 2.0 ... 824.964223 373.518373 50.083795 6.787649 2021.119521 58.080086 37.693265 58.277088 1548.451984 318.617098 Chef-lieu canton 379.0 2448.0 0.0 NaN
4 01004ZZZZ non localisé à l'iris 01004 Ambérieu-en-Bugey 82.0 1 11 101 8201.0 1302 0.0 0.0 0.0 0.0 0.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Chef-lieu canton 379.0 2448.0 0.0 NaN

5 rows × 697 columns


In [50]:
bdx = data[data.LIBCOM == "Bordeaux"]

In [54]:
bdx.tail()


Out[54]:
CODGEO LIBGEO COM LIBCOM REG DEP ARR CV ZE2010 UU2010 NB_B101 NB_B102 NB_B103 NB_B201 NB_B202 ... P11_ACTOCC15P_ILT2 P11_ACTOCC15P_ILT3 P11_ACTOCC15P_ILT4 P11_ACTOCC15P_ILT5 C11_ACTOCC15P C11_ACTOCC15P_PAS C11_ACTOCC15P_MAR C11_ACTOCC15P_DROU C11_ACTOCC15P_VOIT C11_ACTOCC15P_TCOM status mean_altitude superficie is_metropole metropole_name
3071 330631302 Gare Saint-Jean 2 33063 Bordeaux 72.0 33 332 3399 7204.0 33701 0.0 0.0 0.0 0.0 0.0 ... 480.777745 13.244366 26.438013 0.0 1161.608426 15.793024 126.995828 186.567058 637.557604 194.694911 Préfecture de région 9.0 4970.0 1.0 Bordeaux
3072 330631303 Gare Saint-Jean 3 33063 Bordeaux 72.0 33 332 3399 7204.0 33701 0.0 0.0 0.0 0.0 0.0 ... 343.608337 1.809688 16.755296 0.0 905.032535 29.669040 35.208999 58.260912 453.341061 328.552522 Préfecture de région 9.0 4970.0 1.0 Bordeaux
3073 330631304 Gare Saint-Jean 4 33063 Bordeaux 72.0 33 332 3399 7204.0 33701 0.0 3.0 0.0 2.0 4.0 ... 490.168709 26.415934 30.030067 0.0 1237.865530 49.054748 161.996561 100.542405 447.492164 478.779652 Préfecture de région 9.0 4970.0 1.0 Bordeaux
3074 330631305 Gare Saint-Jean 5 33063 Bordeaux 72.0 33 332 3399 7204.0 33701 0.0 0.0 0.0 0.0 1.0 ... 374.314301 12.851111 14.743137 0.0 984.486354 40.039726 90.890145 176.403127 441.651099 235.502257 Préfecture de région 9.0 4970.0 1.0 Bordeaux
3075 33063ZZZZ non localisé à l'iris 33063 Bordeaux 72.0 33 332 3399 7204.0 33701 0.0 1.0 0.0 1.0 1.0 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Préfecture de région 9.0 4970.0 1.0 Bordeaux

5 rows × 697 columns


In [55]:
bdx.LIBGEO.unique()


Out[55]:
array([u'Le Lac 1', u'Le Lac 3', u'Bacalan 1', u'Bacalan 2', u'Bacalan 3',
       u'Bacalan 4', u'Chartrons-Grand-Parc 1', u'Chartrons-Grand-Parc 2',
       u'Chartrons-Grand-Parc 3', u'Chartrons-Grand-Parc 5',
       u'Chartrons-Grand-Parc 6', u'Chartrons-Grand-Parc 7',
       u'Chartrons-Grand-Parc 8', u'Chartrons-Grand-Parc 9',
       u'Chartrons-Grand-Parc 10', u'Chartrons-Grand-Parc 11',
       u'Chartrons-Grand Parc 12', u'Chartrons-Grand Parc 13',
       u'La Bastide 1', u'La Bastide 2', u'La Bastide 3', u'La Bastide 4',
       u'La Bastide 5', u'Hotel de Ville-Quinconces 1',
       u'Hotel de Ville-Quinconces 2', u'Hotel de Ville-Quinconces 3',
       u'Hotel de Ville-Quinconces 4', u'Hotel de Ville-Quinconces 5',
       u'Hotel de Ville-Quinconces 6', u'Hotel de Ville-Quinconces 7',
       u'Hotel de Ville-Quinconces 8', u'Saint-Seurin-Fondaudege 1',
       u'Saint-Seurin-Fondaudege 2', u'Saint-Seurin-Fondaudege 3',
       u'Saint-Seurin-Fondaudege 4', u'Saint-Seurin-Fondaudege 5',
       u'Saint-Seurin-Fondaudege 6', u'Saint-Seurin-Fondaudege 7',
       u'Saint-Seurin-Fondaudege 8', u'Saint-Seurin-Fondaudege 9',
       u'Villa Primerose Parc Bor.-Cauderan 1',
       u'Villa Primerose Parc Bor.-Cauderan 2',
       u'Villa Primerose Parc Bor.-Cauderan 3',
       u'Villa Primerose Parc Bor.-Cauderan 4',
       u'Villa Primerose Parc Bor.-Cauderan 5',
       u'Villa Primerose Parc Bor.-Cauderan 6', u'Lestonat-Monsejour 1',
       u'Lestonat-Monsejour 2', u'Lestonat-Monsejour 3',
       u'Lestonat-Monsejour 4', u'Lestonat-Monsejour 5',
       u'Lestonat-Monsejour 6', u'Lestonat-Monsejour 7',
       u'Lestonat-Monsejour 8', u'Lestonat-Monsejour 9',
       u'Saint-Augustin 1', u'Saint-Augustin 2', u'Saint-Augustin 3',
       u'Saint-Augustin 4', u'Saint-Augustin 5',
       u'Saint-Bruno-Saint-Victor 1', u'Saint-Bruno-Saint-Victor 2',
       u'Saint-Bruno-Saint-Victor 3', u'Saint-Bruno-Saint-Victor 4',
       u'Saint-Bruno-Saint-Victor 5', u'Saint-Bruno-Saint-Victor 6',
       u'Capucins-Victoire 1', u'Capucins-Victoire 2',
       u'Capucins-Victoire 3', u'Capucins-Victoire 4',
       u'Capucins-Victoire 5', u'Capucins-Victoire 6',
       u'Capucins-Victoire 7', u'Capucins-Victoire 8', u'Nansouty 1',
       u'Nansouty 2', u'Nansouty 3', u'Nansouty 4', u'Nansouty 5',
       u'Nansouty 6', u'Nansouty 7', u'Nansouty 8', u'Nansouty 9',
       u'Gare Saint-Jean 1', u'Gare Saint-Jean 2', u'Gare Saint-Jean 3',
       u'Gare Saint-Jean 4', u'Gare Saint-Jean 5',
       u"non localis\xe9 \xe0 l'iris"], dtype=object)

In [57]:
bdx[bdx.LIBGEO.str.contains("Cauderan")][['P11_POP15P_CELIB', 'P11_F1529', 'P11_H1529', 'P11_POP']].sum()


Out[57]:
P11_POP15P_CELIB     5886.463042
P11_F1529            1518.036538
P11_H1529            1527.768310
P11_POP             17608.056425
dtype: float64

In [58]:
bdx[bdx.LIBGEO.str.contains("Chartron")][['P11_POP15P_CELIB', 'P11_F1529', 'P11_H1529', 'P11_POP']].sum()


Out[58]:
P11_POP15P_CELIB    16376.767589
P11_F1529            4932.126668
P11_H1529            4663.318240
P11_POP             35758.120729
dtype: float64

In [60]:
bdx[bdx.LIBGEO.str.contains("Capucins-Victoire")][['P11_POP15P_CELIB', 'P11_F1529', 'P11_H1529', 'P11_POP']].sum()


Out[60]:
P11_POP15P_CELIB    15799.126868
P11_F1529            6458.986015
P11_H1529            5394.170894
P11_POP             21548.562513
dtype: float64

In [47]:
bdx[bdx.LIBGEO.str.contains("Chartron")][['P11_POP15P_CELIB', 'P12_POP15P_CELIB', 'P12_F1529', 'P12_H1529']].sum()


Out[47]:
P11_POP15P_CELIB    16376.767589
P12_POP15P_CELIB    16648.790570
P12_F1529            4944.671688
P12_H1529            4530.768996
dtype: float64

In [93]:
commune_metropole.head()


Out[93]:
COM status mean_altitude superficie is_metropole metropole_name
0 39007 Commune simple 587.0 582.0 0 NaN
1 88086 Commune simple 454.0 396.0 0 NaN
2 62627 Commune simple 49.0 426.0 0 NaN
3 14020 Commune simple 33.0 987.0 0 NaN
4 11091 Chef-lieu canton 455.0 1605.0 0 NaN

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: