import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
datos = pd.read_csv('reporte_instantaneo.csv', sep=';', index_col=1, parse_dates=True, decimal='.', na_values=['-', None])
datos.info()
datos.columns
<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 168 entries, 2015-03-20 00:00:00 to 2015-03-26 23:00:00 Data columns (total 5 columns): Nro. 168 non-null int64 Rio Copiapo en -AltLM (m) 156 non-null float64 Rio Copiapo en -Caudal (m3/seg) 156 non-null float64 Copiapo -PpAcu (mm) 133 non-null float64 Copiapo -Pp1Hra (mm) 126 non-null float64 dtypes: float64(4), int64(1) memory usage: 7.9 KB
Index([u'Nro.', u'Rio Copiapo en -AltLM (m)', u'Rio Copiapo en -Caudal (m3/seg)', u'Copiapo -PpAcu (mm)', u'Copiapo -Pp1Hra (mm)'], dtype='object')
datos.head()
Nro. | Rio Copiapo en -AltLM (m) | Rio Copiapo en -Caudal (m3/seg) | Copiapo -PpAcu (mm) | Copiapo -Pp1Hra (mm) | |
---|---|---|---|---|---|
Fecha-Hora de Medicion | |||||
2015-03-20 00:00:00 | 1 | 0.35 | 1.112 | 0 | 0 |
2015-03-20 01:00:00 | 2 | 0.35 | 1.112 | 0 | 0 |
2015-03-20 02:00:00 | 3 | 0.39 | 1.316 | 0 | 0 |
2015-03-20 03:00:00 | 4 | 0.42 | 1.493 | 0 | 0 |
2015-03-20 04:00:00 | 5 | 0.43 | 1.555 | 0 | 0 |
datos.drop(u'Nro.', axis=1, inplace=True)
datos.plot(figsize=(10, 10), subplots=True, sharex=True)
array([<matplotlib.axes._subplots.AxesSubplot object at 0x096628D0>, <matplotlib.axes._subplots.AxesSubplot object at 0x097834B0>, <matplotlib.axes._subplots.AxesSubplot object at 0x097EA8B0>, <matplotlib.axes._subplots.AxesSubplot object at 0x0981D0B0>], dtype=object)
cols = [col for col in datos.columns if col not in ['Rio Copiapo en -AltLM (m)']]
ax = datos[cols].plot(figsize=(10, 10), secondary_y=[u'Copiapo -PpAcu (mm)', 'Copiapo -Pp1Hra (mm)'])
ax.set_ylabel('(m3/s)')
ax.right_ax.set_ylabel('(mm)')
<matplotlib.text.Text at 0x9c0aaf0>