Sample Data:
Week Price
2011-31 1.58
2011-32 1.9
2011-33 1.9
2011-34 1.9
I have a dataframe like above and I wanna convert 'Week' column type from string to datetime.
My Code:
data['Date_Time'] = pd.to_datetime(data.Week, format='%Y-%W')
data = data.drop(['Week'], axis=1)
data.index = data.Date_Time
Error:
'ValueError: Cannot use '%W' or '%U' without day and year'