python - pandas dataframe timeseries:linegraph per day -
first of all: although quite experienced in spss, i'm absolute beginner in python , pandas. i'm trying learn because think it's far more versatile , flexible...
couldn't find python forum dummies ;) hope can help...
my question: i've got dataframe traffic-data per period of 5 minutes:
in[37]: df.head(3) out[37]: rws01_monibas_0121hrr0070ra_speed \ time 2014-09-29 15:00:00 101.124752 2014-09-29 15:05:00 100.626442 2014-09-29 15:10:00 102.247742 rws01_monibas_0121hrr0070ra_flow \ time 2014-09-29 15:00:00 1824 2014-09-29 15:05:00 2184 2014-09-29 15:10:00 1908 in[38]: df.tail(3) out[38]: rws01_monibas_0121hrr0070ra_speed \ time 2014-10-03 19:45:00 99.089214 2014-10-03 19:50:00 101.561825 2014-10-03 19:55:00 101.178173 rws01_monibas_0121hrr0070ra_flow \ time 2014-10-03 19:45:00 804 2014-10-03 19:50:00 1128 2014-10-03 19:55:00 1284
the dataframe consists of multiple days (in example 4, test-set) , indexed on time. i'm trying split dataframe per date, , create linegraph per date.
when try select part dataframe , create graph df.plot, graph days, whatever do. doing wrong?
part of code:
df['day']=pd.datetimeindex(df['time']).day #select specific day select=pd.series(['23']) df[df.day.isin(select)] df.plot(kind='line',y=2) plt.show()
thanks in advance help, niels
couple of issues:
you plotting original frame instead of filtered one
df[df.day.isin(select)].plot(kind='line',y=2)
day column integer datatype
select=pd.series([23])
this best place start http://shop.oreilly.com/product/0636920023784.do
Comments
Post a Comment