I have a dataframe
where the date column is in format format='%Y-W%W-%w'
. I am converting from the 2018-W01
etc. to an actual date using pd.to_datetime(urldict[key]['date']+'-1', format='%Y-W%W-%w')
, but the data appears to be shifted incorrectly for 2020/2021, I'm guessing because of the leap-year.
Subsequently, it creates two entries for 01-04-2021
, with the first entry being what would be 2020-W53
. The data going back is also misaligned.
I'm not sure how to fix this as I assumed that the datetime library would account for it.
Pre-conversion:
date region total
2020-W51 africa 1
2020-W52 africa 2
2020-W53 africa 3
2021-W01 africa 4
Post-conversion:
date region total
12/21/2020 africa 1
12/28/2020 africa 2
1/4/2021 africa 3
1/4/2021 africa 4