In this example you will go back to https://api.darksky.net and use your API key to get the 7 day weather forecast for any input location.
First you will need to geocode the location to a Latitude and Lognitude. Please use the Python geocoder module for this: https://geocoder.readthedocs.io/
One you gave coordinates use the DarkSky api to get the 7 day forecast (it's the current conditions + 7 days out == 8 days total) for the location.
Extract the forecast data and load it into Pandas, then display the Time of the forecast, and high and low temperatures:
HINT: To get the times to show up in a human-readable format, you must convert the DarkSky API time (which is in unix timestamp format) to a Pandas Timestamp date/time format. The pd.to_datetime()
function can help you:
time = 1489402800 # this the time format Darksky returns
readable_time = pd.to_datetime(time, unit='s') ## s stands for unix timestamp format
readable_time
Timestamp('2017-03-13 11:00:00')
Just replace the ['time']
column in the DataFrame
with the new version.
In [ ]:
# STEP 2: Todo write code here
In [19]:
# Here's my output from when I ran the solution, to give you an example of what I expect to see in Pandas
# Input here was Syrcause, NY (lat=43.0481221, lng=-76.1474244) for example
Out[19]:
Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed? How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?
To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.
Keep your response to between 100 and 250 words.
--== Write Your Reflection Below Here ==--
In [ ]: