Having some issues in being able to differentiate a different set of data based on dates as I'm using the .datetime(Year,Month,Day).strftime
function in Python.
It seems that once it hits the 52 weeks in a year, it starts repeating it again for the next year from Week 0 which is obviously correct.
What I want to know is, is there a way of differentiating the 53rd week (the 1st week of the next year) using various functions or loops?
I'm trying to do this so that I can create a graph that extends to the present date using the weeks as the independent factor (x-axis) - currently it just extends from Week 0 to Week 52 but should realistically extend beyond that.
I've been trying to think of a logic to apply in a for loop
but haven't really wrapped my head around any ideas. Any guidance would be highly appreciated as I'm fairly new to the coding scene.
Thanks!
Edit:
This is what I currently have...
for index, row in dt.iterrows():
Month = dt['Month']
Day = dt['Day']
Year = dt['Year']
date_list.append(datetime.datetime(Year[index], dt['Month'][index], dt['Day'][index]).strftime("%W"))
dt['Week'] = date_list
As my dataset goes through more than 1 years (approx 5 years currently), wouldn't I have to repeat that isocalendar code for Week 54, 55, 56 etc...