Waktu string aggreasi mingguan Python

from collections import defaultdict
from datetime import datetime as dt
curr = '2019-01-01'
idx = 0
dic = defaultdict(list)
for i in ts:
 if ( dt.strptime(i, '%Y-%m-%d') -  dt.strptime(curr, '%Y-%m-%d')).days < 7 :
     dic[idx].append(i)
 else:
    curr = i
    idx += 1
    dic[idx].append(i)
print(dic.values())
Kat