I have a dataset from excel imported in pandas. There is a one column date and time in string format.
16-MAR-16 11.35.27.000000000 AM
05-APR-16 05.21.14.000000000 PM
16-FEB-16 09.56.36.000000000 AM
16-MAR-16 11.35.27.000000000 AM
16-MAR-16 09.28.11.000000000 AM
19-MAY-16 03.50.38.000000000 PM
I want to split this data into date and time into different columns. I have gone through a couple of the same questions but could not find an answer.
This codes that I tried
(1)df["timestamp"] = pd.to_datetime(df['Invoice Date'],dayfirst = True)
(Error)File "C:\Users\admin\Anaconda3\lib\site-packages\dateutil\parser.py", line 559, in parse
raise ValueError("Unknown string format")
ValueError: Unknown string format
(2)from datetime import datetime
df["timestamp"] = df["Invoice Date"].apply(lambda x: datetime.strptime(x,"dd-mmm-yy hh.mm.ss.%f aa"))
(Error) ValueError: time data '16-MAR-16 11.35.27.000000000 AM' does not match format 'dd-mmm-yy hh.mm.ss.%f aa'
Please help me out here.