Reputation: 21
I'm trying to convert 01/02/20(Thu)05:05:17
into DD-MM-YYYY format, but struggling through pandas.
df['_source.now'] = pd.to_datetime(df['_source.now'])
I get this error: ParserError: Unknown string format: 01/02/20(Thu)05:05:17
Upvotes: 0
Views: 257
Reputation: 347
You can try this
# day first, use '%d/%m/%y(%a)%H:%M:%S'
# month first, use '%m/%d/%y(%a)%H:%M:%S'
pd.to_datetime(df['_source.now'],format='%m/%d/%y(%a)%H:%M:%S',errors='coerce').dt.strftime('%d-%m-%Y')
Upvotes: 1