I need to convert a manually inputted field to date. It looks like:
Jul, 4th
Aug, 29th
I honestly don't know how I can remove the ordinal piece (st, nd, th) and convert to date. I tried this approach:
import pandas as pd
import datetime
dt = pd.DataFrame(data=[['July 5th'],['Aug 29th'], ['Sep 2nd']], columns=['Date_temp'])
dt['month'] = dt['Date_temp'].str[0:3]
dt['day_temp'] = dt['Date_temp'].str[4:6]
dt['day'] = dt['day_temp'].str[0]
dt['year'] = datetime.datetime.now().year
dt['Date'] = pd.to_datetime(dt[['month','day','year']])
I got this error:
ValueError: Unable to parse string "Jul" at position 0