353-7 Date and time problem

hello,
can some one help me with this error in the date and time

AttributeError                            Traceback (most recent call last)
<ipython-input-1-7af8ee90f5c5> in <module>
      9 for row in potus:
     10     start_date = row[2]
---> 11     time = start_date.time()
     12     appt_times.append(time)
     13     print(appt_times)

AttributeError: 'str' object has no attribute 'time'

This concerns the screen 353.7.

Hey, Mohamed.

Please review the screen 353.5. You’re getting an error because you’re trying to use a datetime object’s method (datetime.time()) on a string.

Let it be known if this isn’t enough for you to solve the problem so that someone in the community can try to give you further help.

2 Likes

Hello,

this worked on one of the missions working with dates and time in python(7/12) why would it not work using Jupyter Notebook

please find the attachment.

and if you could explain more about the topic i feel i am lost there

Sorry about this, Mohamed. I had a typo in my reply. I previously asked you to review screen 353.7, but I meant 353.5. The hyperlink was correct, but the text was not.

As to why it doesn’t work in your Jupyter Notebook, that’s because in the Dataquest platform you’re not working from a blank slate. The changes from the previous screen carry over to the following screen.

In screen 5 of this mission you changed all the instances of row[2] from strings to datetime objects, this means that you do not have to deal with this again on screen 7, and that’s why it works in the Dataquest platform, and not in your local Jupyter Notebook.

Now that I have clarified that I meant screen 5 and that the interface carries over the changes for you, I hope this will suffice, but definitely let us know if you still need help.

3 Likes