I have the follow df:
time_series date sales
store_0051_item_909446 3/2021 4.0
store_0051_item_909446 4/2021 4.0
store_0051_item_909446 5/2021 1.0
store_0053_item_909446 6/2021 1.0
store_0059_item_909446 7/2021 0.0
Being 'date' week/year. I want transform this field in datetime: week-year. I tried with the follow code:
df['date'] = df['date'].apply(lambda x: datetime.strptime(x, '%W/%Y'))
But, return the follow df:
time_series date sales
store_0051_item_909446 2021-01-01 4.0
store_0051_item_909446 2021-01-01 4.0
store_0051_item_909446 2021-01-01 1.0
store_0053_item_909446 2021-01-01 1.0
store_0059_item_909446 2021-01-01 0.0
What am I missing in the code?