how to draw a multiline chart using python pandas? -


dataframe:

dept,date,que ece,2015-06-25,96 ece,2015-06-24,89 ece,2015-06-26,88 ece,2015-06-19,87 ece,2015-06-23,82 ece,2015-06-30,82 eee,2015-06-24,73 eee,2015-06-23,71 eee,2015-06-25,70 eee,2015-06-19,66 eee,2015-06-27,60 eee,2015-06-22,56 mech,2015-06-27,10 mech,2015-06-22,8 mech,2015-06-25,8 mech,2015-06-19,7 

i need multiline chart grid based on dept column, need each dept in 1 line. ex:ece sparkline should 96,89,88,87,82,82.... wise need other dept also.

i think need pivot , plot:

import matplotlib.pyplot plt  df = df.pivot(index='dept', columns='date', values='que') print df date  2015-06-19  2015-06-22  2015-06-23  2015-06-24  2015-06-25  2015-06-26  \ dept                                                                            ece         87.0         nan        82.0        89.0        96.0        88.0    eee         66.0        56.0        71.0        73.0        70.0         nan    mech         7.0         8.0         nan         nan         8.0         nan     date  2015-06-27  2015-06-30   dept                           ece          nan        82.0   eee         60.0         nan   mech        10.0         nan    df.plot() plt.show() 

you can check docs.

graph


Comments

Popular posts from this blog

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

php - Passing multiple values in a url using checkbox -

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -