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