AnsweredAssumed Answered

pandas anyone?

Question asked by jamesfreddyc on Apr 22, 2013
Latest reply on Apr 25, 2013 by jamesfreddyc
I am attempting to perform some non-GIS specific work within a larger Geoprocessing tool and hoped someone has worked with the Pandas and matplotlib libraries :)

A .csv table containing the fields "PKID" (integer), "STATION" (text), "DAILY_DATE" (datetime), "READVALUE" (double).  I need to group by STATION and plot a figure with DAILY_DATE and READVALUE but I am running into errors: "x and y must have same first dimension".

Of course the issue is that for unique_key ("station"), it can have a different numer of dates.  That is, for some STATION values it could be 10/1/2011, 10/5/2011, 10/31/2011 and for other STATION values it could include each date in the entire month 10/1/2011 thru 10/31/2011.

dtable = pd.io.parsers.read_table(str(datasource), sep=',') unique_keys = np.unique(dtable['STATION']) for key in unique_keys:     index = date_range(np.unique(dtable['STATION']))     values = dtable[dtable['STATION'] == key]     plt.figure()     plt.plot(index, values['READVAL']) <-- fails with x/y dimension error if index has less than full list of dates    


Figured I'd ask here before moving to another forum.
Thanks!
j

Outcomes