for idx, row in group.iterrows():
    days_back_fil = (group[time_col] < row[time_col]) & (group[time_col] >=
        row[time_col] + pd.Timedelta(days_back))
df = group[days_back_fil]
df['days-back'] = (row[time_col] - df[time_col]) / np.timedelta64(1, 'D')
df['weight'] = df[value_col] * df['days-back']
Pandas: взвешенное по времени скользящее среднее с Groupby