HI! I dont understand the if statement below,could you help? Why we need to create 2 dictionaries? and why we put comments_by_hour[hour]=comment and comments_by_hour[hour] +=comment? After i run these codes, 2 dictionary has different output, for example, at 17:00, one has frequency 100 another has frequency 1146.
Thank you so much!
date_format = “%m/%d/%Y %H:%M”
for row in result_list:
hour=dt.datetime.strftime(dateformat,"%H") #extract hour
if hour not in counts_by_hour: