Lucas Dresl
Lucas Dresl

Reputation: 1170

Cannot find the correct way to change string time to datetime

I have a df column with the following days example 2018-07-25 19:23:17.000000 and i cannot find the correct way to convert this string into a datetime value

I've been trying with the following code

 dfa['time_event_utc'] = pd.to_datetime(df['time_event_utc'],format='%d%b%Y:%H:%M:%S +000000',utc=True)

Upvotes: 0

Views: 34

Answers (1)

Yuca
Yuca

Reputation: 6101

your format is '%Y-%m-%d %H:%M:%S.%f'

mydt = '2018-07-25 19:23:17.000000'
datetime.datetime.strptime(mydt , '%Y-%m-%d %H:%M:%S.%f')

Upvotes: 2

Related Questions