mercredi 20 mai 2015

Pandas / SQLITE DataFrame plot

I try to plot data from sqlite but i can't achieve this :-/

p2 = sql.read_sql('select DT_COMPUTE_FORCAST,VALUE_DEMANDE,VALUE_FORCAST from PCE', cnx)

# Data frame p2 show the datas
      DT_COMPUTE_FORCAST  VALUE_DEMANDE  VALUE_FORCAST
0       27/06/2014 06:00          5.128          5.324
1       27/06/2014 07:00          5.779          5.334
2       27/06/2014 08:00          5.539          5.354

df = pd.DataFrame({'Demande' : p2['VALUE_DEMANDE'],'Forcast' :p2['VALUE_FORCAST']},index=p2['DT_COMPUTE_FORCAST'])

df.plot(title='Title Here')

=> My chart is showing but with no values, could you give me a hint ?!

df.info()
<class 'pandas.core.frame.DataFrame'>
Index: 20109 entries, 27/06/2014 06:00 to 11/05/2015 05:00
Data columns (total 2 columns):
Demande    0 non-null float64
Forcast    0 non-null float64
dtypes: float64(2)
memory usage: 392.8+ KB

the followinf sentence is the correct or i miss something ?:

df = pd.DataFrame({'Demande' : p2['VALUE_DEMANDE'],'Forcast' : p2['VALUE_FORCAST']},index=p2['DT_COMPUTE_FORCAST'])

Aucun commentaire:

Enregistrer un commentaire