-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hello,
It will be nice if get_historic_weather
could output Pandas DataFrame:
Here is a very basic code
import pandas as pd
data = ow.get_historic_weather(station_id, start_date, end_date)
df = pd.DataFrame(data)
df['dt'] = pd.to_datetime(df['dt'], unit='s') # convert unix timestamp to datetime
df = df.set_index('dt') # dt is now index of DataFrame
So plotting temperature is now very easy:
import matplotlib.pyplot as plt
df['temp'].map(lambda d: d['ma'] - 273.15).plot()
plt.show()
But that not enough because ideally each column of this dataframe should also be split according dict keys.
Moreover using Pandas Daframe it will be very easy to output CSV or anything else (database table, HDF5, Excel file...)
see http://pandas.pydata.org/pandas-docs/dev/io.html
Kind regards
Metadata
Metadata
Assignees
Labels
No labels