Screen Link:
https://app.dataquest.io/m/353/working-with-dates-and-times-in-python/6/using-strftime-to-format-dates
Please what why the error in my code
Screen Link:
https://app.dataquest.io/m/353/working-with-dates-and-times-in-python/6/using-strftime-to-format-dates
Please what why the error in my code
It’s still showing me error on “visitors_per_month”
in line 4, it seems you’ve written appt_start_date - row[2]
, it should be appt_start_date = row[2]
No, i used “=” not “-”
you used strptime
instead of strftime
.
Check instruction 2:
datetime.strftime()
method on the appt_start_date
object to create a string in the format "January, 1901"
.visitors_per_month = {}
for row in potus:
appt_start_date = row[2]
date_fmt = appt_start_date.strftime("%B, %Y")
if date_fmt in visitors_per_month:
visitors_per_month[date_fmt] += 1
else:
visitors_per_month[date_fmt] = 1
My code is working. Thanks