scls19fr / openweathermap_requests

Python package to fetch data from OpenWeatherMap.org with requests and requests-cache
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

Show usage with Pandas for historical hourly data #5

Closed scheung38 closed 9 years ago

scheung38 commented 9 years ago

I do not see examples of using Pandas to show historical hourly data? Thanks

scls19fr commented 9 years ago

get_historic_weather should return a Pandas DataFrame but it is working only with some station_id (because of some limitations of OpenWeatherMap)

try in a web browser

http://api.openweathermap.org/data/2.5/history/station?type=hour&end=1422748799&start=1422662400&appid=YOURAPPID&id=5530

use http://www.onlineconversion.com/unix_time.htm for "end" and "start"

You will see that there is no data !! ("list" key)

You need to find first your nearest station

http://api.openweathermap.org/data/2.5/weather?appid=YOURAPPID&lat=YOURLAT&lon=YOURLON

if you don't find a station_id with historical data available through API I can't help you.

If you find an other website with data freely available I suggest you to use requests

http://www.python-requests.org/en/latest/