I try to store the number of weekofyear from the list of data named date_range
which stored the data such as
date_range[1] = DatetimeIndex(['2020-03-02', '2020-03-03', '2020-03-04', '2020-03-05',
'2020-03-06', '2020-03-07', '2020-03-08', '2020-03-09',
'2020-03-10', '2020-03-11', '2020-03-12', '2020-03-13',
'2020-03-14', '2020-03-15', '2020-03-16', '2020-03-17',
'2020-03-18', '2020-03-19', '2020-03-20', '2020-03-21',
'2020-03-22', '2020-03-23', '2020-03-24', '2020-03-25',
'2020-03-26', '2020-03-27', '2020-03-28', '2020-03-29',
'2020-03-30', '2020-03-31', '2020-04-01', '2020-04-02',
'2020-04-03', '2020-04-04', '2020-04-05'],
dtype='datetime64[ns]', freq='D')
by using the following code
weeknumber= []
for i in range(28):
for j in range(35):
weeknumber[i][j] = pd.Timestamp(date_range[i][j]).weekofyear
However,the IDE show the error 'list assignment index out of range'. How to solve this problem ?