I attempt to loop through daily weather data in 2019 using forecastiopy but the error keeps showing. Not sure what the problem is.
import pandas as pd
import requests
import json
from forecastiopy import *
from datetime import date, timedelta, datetime
import datetime
key = 'xxxxx'
city = [40.730610, -73.935242]
start = datetime.datetime(2019, 1, 1)
for day in range(1,365):
fio = ForecastIO.ForecastIO(key,
units=ForecastIO.ForecastIO.UNITS_SI,
lang=ForecastIO.ForecastIO.LANG_ENGLISH,
latitude=city[0],
longitude=city[1],
time=start+datetime.timedelta(day))
daily = FIODaily.FIODaily(fio)
print ('Max Temperature', daily.get_day(day)['temperatureMax'])
print ('Min Temperature:', daily.get_day(day)['temperatureMin'])
print ('Precipitation Pobability:', daily.get_day(day)['precipProbability'])
print ('Precipitation Intensity', daily.get_day(day)['precipIntensity'])
The error shown is below.