Result as a DataFrame

17 views
Skip to first unread message

Hugo Pires

unread,
May 4, 2014, 10:28:49 AM5/4/14
to ul...@googlegroups.com
Hello

I am trying to get the Lisbon Climatic Data using

data = ulmo.ncdc.ghcn_daily.get_data('PO000008506', as_dataframe=True)

How can I get a DataFrame, since the result is a Dictionary?

Thank you

Hugo

Dharhas Pothina

unread,
May 5, 2014, 5:23:55 PM5/5/14
to ul...@googlegroups.com

When you use as_dataframe=True, ulmo is returning a dictionary of pandas dataframes, one for each parameter. For example in your case, data['PRCP'] is a dataframe that includes the various flags that comes with each parameter.

If what you want is the all the parameter values in one dataframe, you could do the following:

import pandas as pd
df = pd.concat({col:data[col]['value'] for col in data.keys()}, axis=1)

this will give you a dataframe that has time as the index and the parameters as columns.

- dharhas




--
You received this message because you are subscribed to the Google Groups "ulmo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ulmo+uns...@googlegroups.com.
To post to this group, send email to ul...@googlegroups.com.
Visit this group at http://groups.google.com/group/ulmo.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages