I rarely can connected to the virtual machine in the classroom, so I practice locally, got confused for above code in the screenshot I took:
Should row be first transfer to a datatime object, then use strptime() function to create a string from it?
The given answer use the strings from row directly, please check this part: 6. Using Strftime to format dates On working with dates and times in Python, thank you.
Welcome to our Dataquest Community.
Actually, element of
row already in
datetime format, variable
month_dt passes in method
strftime and return after calculation in
You can check the format of 3nd element of row (it is of list type), by running this command.
print(type(potus)) # Output:- <class 'datetime.datetime'>
Hope this helps .
Thank you for answering my question, I understand what you mean, but I have a new puzzle which is when row be updated to
The online programming platform doesn’t give any comments that says row already been converted to be
datetime and the raw type for row from the dataset is string format.
@evamalloc see slide 5, where you are converting all 3nd element of each
potus list into