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.

Était-ce utile?

La 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')
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top