import numpy as np def resample(x, t, start, end, step): bins = np.arange(start, end+step, step) inds = np.digitize(t,bins) n = x.shape[0] y = np.empty((n, len(bins))) * np.nan for i in range(n): y[i,inds[i,:]] = x[i,:] return y, bins x = [3,6,9,12,15,18,21,24] t = [0,4,8,10,45,67,78,90] x_re, t_re = resample(x, t, 0, 100, 5)