date_range bug for 
I need help!!

When I use this code :

debut = df_idmatch.date.min().replace(tzinfo=None)
fin = df_idmatch.date.max().replace(tzinfo=None)
print(debut, fin)
dates=pd.date_range(start=debut,end=fin,freq='W')            
date_index=dates.year.astype(str)+"-"+dates.weekofyear.astype(str).str.zfill(2)
date_index.tolist()

There is a trouble when you pass from the end of the year to next year. If you print date_index, it will print you :

Index(['2020-38', '2020-39', '2020-40', '2020-41', '2020-42', '2020-43',
       '2020-44', '2020-45', '2020-46', '2020-47', '2020-48', '2020-49',
       '2020-50', '2020-51', '2020-52', '**2021-53**', '2021-01', '2021-02',
       '2021-03', '2021-04', '2021-05', '2021-06', '2021-07', '2021-08',
       '2021-09', '2021-10', '2021-11', '2021-12', '2021-13', '2021-14',
       '2021-15', '2021-16', '2021-17', '2021-18', '2021-19', '2021-20',
       '2021-21', '2021-22', '2021-23', '2021-24', '2021-25', '2021-26',
       '2021-27', '2021-28', '2021-29', '2021-30'],
      dtype='object')

in fact, 2021-53 should be 2020-53
is it a problem with the date_range fonction or is it inside my own code ?

Regards,

Thibaud