Qualité de l'air mesurée dans la station Châtelet

TODO: l'index du dataframe devrait être constitué de la fusion des deux premières colonnes avec le bon dtype (un datetime Pandas).

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]:
def conv_func(s):
    s = s.replace('<', '')
    if s == 'ND':
        return np.nan
    elif s.strip() == '':
        return np.nan
    else:
        return float(s)
In [3]:
url = "https://data.iledefrance.fr/explore/dataset/qualite-de-lair-mesuree-dans-la-station-chatelet/download/?format=csv&timezone=Europe/Berlin&use_labels_for_header=true"

dtype_dict = {'NO': np.float64,
              'NO2': np.float64,
              'PM10': np.float64,
              'CO2': np.float64,
              'TEMP': np.float64,
              'HUMI': np.float64}

converter_dict = {'NO': conv_func,
                  'NO2': conv_func,
                  'PM10': conv_func,
                  'CO2': conv_func,
                  'TEMP': conv_func,
                  'HUMI': conv_func}

df = pd.read_csv(url,
                 #encoding='iso-8859-1',
                 sep=';',
                 decimal=',',
                 #dtype=dtype_dict,
                 #na_values='ND',
                 converters=converter_dict)

df.astype(dtype_dict)
Out[3]:
DATE HEURE NO NO2 PM10 CO2 TEMP HUMI
0 04/03/2013 13:00 51.0 63.0 98.0 683.0 16.0 38.8
1 04/03/2013 14:00 38.0 62.0 108.0 721.0 16.7 39.4
2 04/03/2013 17:00 36.0 64.0 144.0 935.0 17.9 43.6
3 04/03/2013 21:00 39.0 72.0 100.0 616.0 17.5 43.4
4 05/03/2013 01:00 11.0 59.0 54.0 473.0 16.0 40.9
5 05/03/2013 08:00 166.0 98.0 124.0 732.0 16.6 39.7
6 05/03/2013 10:00 81.0 81.0 113.0 655.0 16.8 36.7
7 05/03/2013 11:00 102.0 88.0 112.0 680.0 17.3 35.5
8 05/03/2013 12:00 66.0 83.0 110.0 692.0 17.5 35.4
9 05/03/2013 14:00 35.0 69.0 189.0 842.0 18.3 36.4
10 06/03/2013 03:00 3.0 42.0 21.0 477.0 17.2 39.2
11 06/03/2013 07:00 97.0 74.0 110.0 602.0 18.0 39.2
12 06/03/2013 13:00 64.0 81.0 117.0 758.0 19.3 39.6
13 06/03/2013 14:00 67.0 88.0 120.0 758.0 19.3 40.5
14 06/03/2013 21:00 42.0 73.0 99.0 662.0 19.4 50.0
15 07/03/2013 03:00 12.0 52.0 16.0 472.0 17.8 55.1
16 08/03/2013 04:00 16.0 41.0 15.0 464.0 17.3 59.4
17 08/03/2013 07:00 98.0 55.0 79.0 596.0 18.3 58.7
18 09/03/2013 06:00 7.0 37.0 48.0 502.0 18.4 54.7
19 09/03/2013 08:00 35.0 59.0 51.0 548.0 17.8 54.8
20 09/03/2013 15:00 21.0 61.0 104.0 848.0 20.0 43.6
21 10/03/2013 14:00 11.0 33.0 59.0 652.0 17.8 42.8
22 11/03/2013 04:00 2.0 15.0 34.0 443.0 14.8 47.7
23 11/03/2013 10:00 34.0 41.0 91.0 630.0 16.0 38.8
24 27/03/2013 02:00 2.0 26.0 134.0 NaN 14.7 27.6
25 27/03/2013 16:00 17.0 63.0 99.0 759.0 17.4 26.4
26 28/03/2013 12:00 24.0 63.0 106.0 651.0 16.9 28.5
27 30/03/2013 12:00 7.0 45.0 115.0 747.0 16.1 29.9
28 30/03/2013 18:00 9.0 58.0 133.0 947.0 17.3 28.0
29 01/04/2013 06:00 3.0 39.0 67.0 484.0 14.3 29.7
... ... ... ... ... ... ... ... ...
35009 20/10/2015 11:00 73.0 33.0 151.0 621.0 21.0 47.7
35010 21/10/2015 06:00 68.0 37.0 95.0 520.0 20.1 46.1
35011 21/10/2015 13:00 43.0 43.0 315.0 626.0 21.6 40.0
35012 22/10/2015 06:00 34.0 27.0 114.0 518.0 21.3 52.6
35013 22/10/2015 16:00 42.0 39.0 181.0 718.0 23.2 53.0
35014 23/10/2015 06:00 28.0 33.0 138.0 524.0 21.8 47.2
35015 23/10/2015 12:00 23.0 41.0 232.0 773.0 23.6 37.7
35016 23/10/2015 16:00 33.0 39.0 315.0 790.0 24.1 38.0
35017 23/10/2015 19:00 37.0 57.0 127.0 673.0 23.6 38.0
35018 23/10/2015 21:00 46.0 56.0 110.0 548.0 22.8 38.5
35019 24/10/2015 01:00 12.0 35.0 49.0 435.0 22.3 38.3
35020 24/10/2015 04:00 11.0 26.0 48.0 446.0 22.2 42.0
35021 24/10/2015 14:00 26.0 31.0 142.0 670.0 22.9 46.1
35022 25/10/2015 00:00 10.0 24.0 123.0 485.0 22.6 49.5
35023 25/10/2015 15:00 8.0 22.0 116.0 565.0 22.2 42.4
35024 25/10/2015 23:00 34.0 34.0 86.0 493.0 21.4 45.1
35025 26/10/2015 04:00 8.0 16.0 28.0 430.0 21.3 47.2
35026 26/10/2015 08:00 46.0 24.0 214.0 614.0 21.4 48.5
35027 26/10/2015 13:00 54.0 27.0 182.0 674.0 22.4 48.1
35028 26/10/2015 18:00 66.0 31.0 277.0 840.0 23.8 52.5
35029 27/10/2015 21:00 71.0 47.0 120.0 534.0 24.2 50.2
35030 28/10/2015 03:00 17.0 27.0 72.0 422.0 22.3 57.0
35031 28/10/2015 20:00 52.0 54.0 155.0 581.0 23.8 42.1
35032 28/10/2015 21:00 52.0 54.0 114.0 503.0 23.2 42.7
35033 29/10/2015 02:00 25.0 31.0 91.0 426.0 21.5 47.3
35034 29/10/2015 09:00 63.0 39.0 654.0 605.0 22.2 49.8
35035 29/10/2015 19:00 77.0 48.0 157.0 710.0 23.7 48.1
35036 30/10/2015 16:00 36.0 35.0 170.0 756.0 23.9 45.4
35037 31/10/2015 18:00 62.0 38.0 172.0 862.0 24.1 49.6
35038 02/11/2015 08:00 59.0 22.0 176.0 703.0 21.7 43.2

35039 rows × 8 columns

In [4]:
df
Out[4]:
DATE HEURE NO NO2 PM10 CO2 TEMP HUMI
0 04/03/2013 13:00 51.0 63.0 98.0 683.0 16.0 38.8
1 04/03/2013 14:00 38.0 62.0 108.0 721.0 16.7 39.4
2 04/03/2013 17:00 36.0 64.0 144.0 935.0 17.9 43.6
3 04/03/2013 21:00 39.0 72.0 100.0 616.0 17.5 43.4
4 05/03/2013 01:00 11.0 59.0 54.0 473.0 16.0 40.9
5 05/03/2013 08:00 166.0 98.0 124.0 732.0 16.6 39.7
6 05/03/2013 10:00 81.0 81.0 113.0 655.0 16.8 36.7
7 05/03/2013 11:00 102.0 88.0 112.0 680.0 17.3 35.5
8 05/03/2013 12:00 66.0 83.0 110.0 692.0 17.5 35.4
9 05/03/2013 14:00 35.0 69.0 189.0 842.0 18.3 36.4
10 06/03/2013 03:00 3.0 42.0 21.0 477.0 17.2 39.2
11 06/03/2013 07:00 97.0 74.0 110.0 602.0 18.0 39.2
12 06/03/2013 13:00 64.0 81.0 117.0 758.0 19.3 39.6
13 06/03/2013 14:00 67.0 88.0 120.0 758.0 19.3 40.5
14 06/03/2013 21:00 42.0 73.0 99.0 662.0 19.4 50.0
15 07/03/2013 03:00 12.0 52.0 16.0 472.0 17.8 55.1
16 08/03/2013 04:00 16.0 41.0 15.0 464.0 17.3 59.4
17 08/03/2013 07:00 98.0 55.0 79.0 596.0 18.3 58.7
18 09/03/2013 06:00 7.0 37.0 48.0 502.0 18.4 54.7
19 09/03/2013 08:00 35.0 59.0 51.0 548.0 17.8 54.8
20 09/03/2013 15:00 21.0 61.0 104.0 848.0 20.0 43.6
21 10/03/2013 14:00 11.0 33.0 59.0 652.0 17.8 42.8
22 11/03/2013 04:00 2.0 15.0 34.0 443.0 14.8 47.7
23 11/03/2013 10:00 34.0 41.0 91.0 630.0 16.0 38.8
24 27/03/2013 02:00 2.0 26.0 134.0 NaN 14.7 27.6
25 27/03/2013 16:00 17.0 63.0 99.0 759.0 17.4 26.4
26 28/03/2013 12:00 24.0 63.0 106.0 651.0 16.9 28.5
27 30/03/2013 12:00 7.0 45.0 115.0 747.0 16.1 29.9
28 30/03/2013 18:00 9.0 58.0 133.0 947.0 17.3 28.0
29 01/04/2013 06:00 3.0 39.0 67.0 484.0 14.3 29.7
... ... ... ... ... ... ... ... ...
35009 20/10/2015 11:00 73.0 33.0 151.0 621.0 21.0 47.7
35010 21/10/2015 06:00 68.0 37.0 95.0 520.0 20.1 46.1
35011 21/10/2015 13:00 43.0 43.0 315.0 626.0 21.6 40.0
35012 22/10/2015 06:00 34.0 27.0 114.0 518.0 21.3 52.6
35013 22/10/2015 16:00 42.0 39.0 181.0 718.0 23.2 53.0
35014 23/10/2015 06:00 28.0 33.0 138.0 524.0 21.8 47.2
35015 23/10/2015 12:00 23.0 41.0 232.0 773.0 23.6 37.7
35016 23/10/2015 16:00 33.0 39.0 315.0 790.0 24.1 38.0
35017 23/10/2015 19:00 37.0 57.0 127.0 673.0 23.6 38.0
35018 23/10/2015 21:00 46.0 56.0 110.0 548.0 22.8 38.5
35019 24/10/2015 01:00 12.0 35.0 49.0 435.0 22.3 38.3
35020 24/10/2015 04:00 11.0 26.0 48.0 446.0 22.2 42.0
35021 24/10/2015 14:00 26.0 31.0 142.0 670.0 22.9 46.1
35022 25/10/2015 00:00 10.0 24.0 123.0 485.0 22.6 49.5
35023 25/10/2015 15:00 8.0 22.0 116.0 565.0 22.2 42.4
35024 25/10/2015 23:00 34.0 34.0 86.0 493.0 21.4 45.1
35025 26/10/2015 04:00 8.0 16.0 28.0 430.0 21.3 47.2
35026 26/10/2015 08:00 46.0 24.0 214.0 614.0 21.4 48.5
35027 26/10/2015 13:00 54.0 27.0 182.0 674.0 22.4 48.1
35028 26/10/2015 18:00 66.0 31.0 277.0 840.0 23.8 52.5
35029 27/10/2015 21:00 71.0 47.0 120.0 534.0 24.2 50.2
35030 28/10/2015 03:00 17.0 27.0 72.0 422.0 22.3 57.0
35031 28/10/2015 20:00 52.0 54.0 155.0 581.0 23.8 42.1
35032 28/10/2015 21:00 52.0 54.0 114.0 503.0 23.2 42.7
35033 29/10/2015 02:00 25.0 31.0 91.0 426.0 21.5 47.3
35034 29/10/2015 09:00 63.0 39.0 654.0 605.0 22.2 49.8
35035 29/10/2015 19:00 77.0 48.0 157.0 710.0 23.7 48.1
35036 30/10/2015 16:00 36.0 35.0 170.0 756.0 23.9 45.4
35037 31/10/2015 18:00 62.0 38.0 172.0 862.0 24.1 49.6
35038 02/11/2015 08:00 59.0 22.0 176.0 703.0 21.7 43.2

35039 rows × 8 columns

In [5]:
df.columns
Out[5]:
Index(['DATE', 'HEURE', 'NO', 'NO2', 'PM10', 'CO2', 'TEMP', 'HUMI'], dtype='object')
In [6]:
df.loc[:,['PM10', 'CO2']].plot(figsize=(16,6))
Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x1117e97b8>
In [7]:
df.loc[:,['NO', 'NO2']].plot(figsize=(16,6))
Out[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x10bf6a278>
In [8]:
df.loc[:,['TEMP', 'HUMI']].plot(figsize=(16,6))
Out[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x10bf89128>