You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 20, 2021. It is now read-only.
Is your feature request related to a problem? Please describe.
Many libraries that expect weather data as an input use pandas dataframes as the standard data object (PVLib for example). Also, being able to return a pandas dataframe will make it easier to print, plot, and process data returned from darksky.
Describe the solution you'd like
A method called "to_frame()" which returns a DatetimeIndex'd dataframe of weather data.
# print the start of the forecast print(hourly_forecast_dataframe.head())
# plot the temperature hourly_forecast_dataframe.plot(y='temperature')
Describe alternatives you've considered
Currently I use a function which accepts a forecast as an argument and returns a dataframe. This works just fine, but a built-in method would be nice."
The text was updated successfully, but these errors were encountered:
import pandas as pd
def darksky_forecast_to_dataframe(forecast):
"""Convert darksky forecast data list to a dataframe
Keyword arguments:
forecast -- list of daksky forecast items
Returns:
df -- DatetimeIndexed pandas dataframe of the forecast data
"""
# convert list of forecast items to list of dictionaries
data = [entry.__dict__ for entry in forecast]
# make the dataframe
df = pd.DataFrame(data)
# use time as the index
df.set_index('time', inplace=True)
return df
Is your feature request related to a problem? Please describe.
Many libraries that expect weather data as an input use pandas dataframes as the standard data object (PVLib for example). Also, being able to return a pandas dataframe will make it easier to print, plot, and process data returned from darksky.
Describe the solution you'd like
A method called "to_frame()" which returns a DatetimeIndex'd dataframe of weather data.
weather = darksky.get_time_machine_forecast(...)
hourly_forecast_dataframe = weather.hourly.to_frame()
# print the start of the forecast
print(hourly_forecast_dataframe.head())
# plot the temperature
hourly_forecast_dataframe.plot(y='temperature')
Describe alternatives you've considered
Currently I use a function which accepts a forecast as an argument and returns a dataframe. This works just fine, but a built-in method would be nice."
The text was updated successfully, but these errors were encountered: