I need help: pandas dataset has a date column. The date in one of the columns is in the format "September 25, 2021 ". I can't convert this to "yyyy-mm-dd" format (2021-09-25). This is necessary in order to import this data into mysql in the future (I work through dbever). Might be a stupid question but I'm a newbie
Tried to use to_datetime function and this way (IndexError: list index out of range):
date = {'January': '01', 'February': '02', 'March': '03', 'April': '04', 'May': '05', 'June': '06',
'July': '07', 'August': '08', 'September': '09', 'October': '10', 'November': '11', 'December': '12'}
new_date = []
for d in df['date_added']:
month = d.split(' ')[0]
day = d.split(' ')[1]
year = d.split(', ')[2]
res = year.split('-') + date[month].split('-') + day
new_date.append(res)