Last answered:

22 Nov 2022

Posted on:

18 Nov 2022

0

Problem in converting the Date column into a datetime

When I checked the type:
print(type(df['Date']))
print(type(df['Date'][0))
I got <class 'pandas.core.series.Series'>
<class 'numpy.float64'>

Yet I tried to convert it to a time stamp as you did :
df_check['Date'] = pd.to_datetime(df_check['Date'] , format = '%d/%m/%Y')
and when I print it, I recieve ValueError: time data '239' does not match format '%d\%m\%Y' (match) I tried the \ and / yet it is the same error

1 answers ( 0 marked as helpful)
Instructor
Posted on:

22 Nov 2022

0

Hi Salma!
Thanks for reaching out.

Could you please make a screenshot of your Jupyter Notebook after you run a cell with the code:
df_check['Date']? Thank you.

Looking forward to your answer.
Best,
Tsvetelin

Submit an answer