win = 10
avg_idx = np.arange(-win, win + 1) + indices[:, (None)]
avg_val = np.tile(values[:, (None)] / (2 * win + 1), (1, 2 * win + 1))
Efficiently take moving average of sparse data and filter above threshold in python