Dictionary: section of dictionary
My Code: code
Error says: 3
So how come the date key works fine but for freq it fails?
ps. my first time posting, so am very sorry for the sloppy structure of the post
CodePudding user response:
This can only happen when one of your day is missing the freq
parameter.
Try catching the day in which the error is happening. Then manually check that particular entry.
date_list = []
frequency_list = []
try:
for i in obj:
date = obj[i]["date"]
frequency = obj[i]["freq"]
date_list.append(date)
frequency_list.append(frequency)
except:
print(i)