In [30]:
import pandas as pd
import matplotlib.pyplot as plt
In [31]:
air_quality = pd.read_csv("air_quality_no2.csv", index_col=0, parse_dates=True)
In [32]:
air_quality.head()
Out[32]:
station_antwerp station_paris station_london
datetime
2019-05-07 02:00:00 NaN NaN 23.0
2019-05-07 03:00:00 50.5 25.0 19.0
2019-05-07 04:00:00 45.0 27.7 19.0
2019-05-07 05:00:00 NaN 50.4 16.0
2019-05-07 06:00:00 NaN 61.9 NaN
In [33]:
air_quality.plot()
Out[33]:
<Axes: xlabel='datetime'>
No description has been provided for this image
In [34]:
plt.show()
In [35]:
air_quality["station_paris"].plot()
Out[35]:
<Axes: xlabel='datetime'>
No description has been provided for this image
In [36]:
plt.show()
In [37]:
air_quality.plot.scatter(x="station_london", y="station_paris", alpha=0.5)
Out[37]:
<Axes: xlabel='station_london', ylabel='station_paris'>
No description has been provided for this image
In [38]:
plt.show()
In [39]:
[
    method_name
    for method_name in dir(air_quality.plot)
    if not method_name.startswith("_")
]
Out[39]:
['area',
 'bar',
 'barh',
 'box',
 'density',
 'hexbin',
 'hist',
 'kde',
 'line',
 'pie',
 'scatter']
In [40]:
air_quality.plot.box()
Out[40]:
<Axes: >
No description has been provided for this image
In [41]:
plt.show()
In [42]:
axs = air_quality.plot.area(figsize=(12, 4), subplots=True)
No description has been provided for this image
In [43]:
plt.show()
In [44]:
fig, axs = plt.subplots(figsize=(12, 4))
No description has been provided for this image
In [45]:
air_quality.plot.area(ax=axs)
Out[45]:
<Axes: xlabel='datetime'>
In [46]:
axs.set_ylabel("NO$_2$ concentration")
Out[46]:
Text(4.444444444444466, 0.5, 'NO$_2$ concentration')
In [47]:
fig.savefig("no2_concentrations.png")
In [48]:
plt.show()