Reputation: 33
I have a separate column with HH:MM: SS object type. I want to convert object type to DateTime format. Encountering the error below.
Dataset time column ["ACCIDENT_TIME]:
Upvotes: 0
Views: 371
Reputation: 125
You can try the below one also:
import pandas as pd
df['col_name'] = pd.to_datetime(df['col_name'], errors='coerce')
Upvotes: 1
Reputation: 125
if you want to change dtype of column you can do in below way:
df['col_name'] = df['col_name'].astype('datetime64[ns]')
Upvotes: 0