Timestamp datetime64 to datetime in dataframe

133 views Asked by At

I am confused with datetime64 and trying convert it to a normal time format.

I have a column with timestamp format: 2022.01.02D23:10:12.197164900.

Output expected is: 2022-01-02 23:10:12

I'm trying with:

df['executionTime'] = pd.to_datetime(df['executionTime'], format='%Y-%m-%d %H:%M:%S.%f', errors='coerce')
1

There are 1 answers

9
AudioBubble On BEST ANSWER

Try this:

df['executionTime'] = pd.to_datetime(df['executionTime'], format='%Y.%m.%dD%H:%M:%S.%f', errors='coerce')