سؤال

I need to apply a specially designed moving average filter on a traffic dataset (NGSim). This process is very tedious in Excel not only because dataset is very large but also because the formula has to look into columns for getting some values and sum them up. I was wondering if there are any examples like this or any other complicated formulas used in Pandas, Python. Kindly provide any example resources.

هل كانت مفيدة؟

المحلول

You are probably looking for rolling_apply. This is an example from the documentation:

mad = lambda x: np.fabs(x - x.mean()).mean()
rolling_apply(ts, 60, mad).plot(style='k')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top