Question

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.

Was it helpful?

Solution

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')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top