def get_relative_prices(walking_time, smoothed_prices):
x = walking_time.flatten()
y = smoothed_prices.flatten()
mask = sp.isnan(x) | sp.isnan(y)
spline = sp.interpolate.UnivariateSpline(x[~mask], y[~mask], s=len(x))
v = spline(x)
rel = (y - v).reshape(walking_time.shape)
return rel
评论列表
文章目录