I have a column cash_date in pandas dataframe which is a object. I am not able to use pandas to_datetime function here. Shape of my data frame is (47654566,5).My data frame looks like
cash_date amount id
02-JAN-13 12.00.00.000000000 AM 100 1
13-FEB-13 12.00.00.000000000 AM 200 2
09-MAR-13 12.00.00.000000000 AM 300 3
03-APR-13 12.00.00.000000000 AM 400 4
02-JAN-13 06.26.02.438000000 PM 500 7
17-NOV-18 08.31.47.443000000 PM 700 8
I tried following ways -
df.cash_date = pd.to_datetime(df['cash_date'], errors='coerce') # Not working
for i in range(len(df)):
df.cash_date = df.cash_date.astype(str).str.split('\d\d.\d\d.\d\d.\d\d\d\d\d\d\d\d\d')[i][0] # Not working
I want the data frame looks like s-
cash_date amount id date
02-JAN-13 12.00.00.000000000 AM 100 1 02-JAN-13
13-FEB-13 12.00.00.000000000 AM 200 2 13-FEB-13
09-MAR-13 12.00.00.000000000 AM 300 3 09-MAR-13
03-APR-13 12.00.00.000000000 AM 400 4 03-APR-13
02-JAN-13 06.26.02.438000000 PM 500 7 02-JAN-13
17-NOV-18 08.31.47.443000000 PM 700 8 17-NOV-18