Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df.rolling(window = 10).apply(lambda x: acf(x, nlags = 5)[5]).plot()
- df.rolling(window = 10).apply(lambda x: list(acf(x, nlags = 5)))
- ---------------------------------------------------------------------------
- TypeError Traceback (most recent call last)
- <ipython-input-63-e5f337100eb5> in <module>()
- ----> 1 df.rolling(window = 10).apply(lambda x: list(acf(x, nlags = 5)))
- /Users/a/anaconda3/lib/python3.5/site-packages/pandas/core/window.py in apply(self, func, args, kwargs)
- 861 @Appender(_shared_docs['apply'])
- 862 def apply(self, func, args=(), kwargs={}):
- --> 863 return super(Rolling, self).apply(func, args=args, kwargs=kwargs)
- 864
- 865 @Substitution(name='rolling')
- /Users/a/anaconda3/lib/python3.5/site-packages/pandas/core/window.py in apply(self, func, args, kwargs)
- 619
- 620 return self._apply(f, func, args=args, kwargs=kwargs,
- --> 621 center=False)
- 622
- 623 def sum(self, **kwargs):
- /Users/a/anaconda3/lib/python3.5/site-packages/pandas/core/window.py in _apply(self, func, name, window, center, check_minp, how, **kwargs)
- 556
- 557 if values.ndim > 1:
- --> 558 result = np.apply_along_axis(calc, self.axis, values)
- 559 else:
- 560 result = calc(values)
- /Users/a/anaconda3/lib/python3.5/site-packages/numpy/lib/shape_base.py in apply_along_axis(func1d, axis, arr, *args, **kwargs)
- 89 outshape = asarray(arr.shape).take(indlist)
- 90 i.put(indlist, ind)
- ---> 91 res = func1d(arr[tuple(i.tolist())], *args, **kwargs)
- 92 # if res is a number, then we have a smaller output array
- 93 if isscalar(res):
- /Users/a/anaconda3/lib/python3.5/site-packages/pandas/core/window.py in calc(x)
- 553
- 554 def calc(x):
- --> 555 return func(x, window, min_periods=self.min_periods)
- 556
- 557 if values.ndim > 1:
- /Users/a/anaconda3/lib/python3.5/site-packages/pandas/core/window.py in f(arg, window, min_periods)
- 616 minp = _use_window(min_periods, window)
- 617 return algos.roll_generic(arg, window, minp, offset, func, args,
- --> 618 kwargs)
- 619
- 620 return self._apply(f, func, args=args, kwargs=kwargs,
- pandas/algos.pyx in pandas.algos.roll_generic (pandas/algos.c:51581)()
- TypeError: a float is required
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement