Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(
self,
pandas_obj,
npartitions=None,
dask_threshold=1,
scheduler="processes",
progress_bar=True,
progress_bar_desc=None,
allow_dask_on_strings=False,
**kwds
):
super(Rolling, self).__init__(
pandas_obj, npartitions, dask_threshold, scheduler, progress_bar, progress_bar_desc, allow_dask_on_strings
)
self._rolling_kwds = kwds.copy()
self._comparison_pd = self._obj_pd.iloc[: self._npartitions * 2]
self._sample_pd = self._sample_pd.rolling(**kwds)
self._obj_pd = self._obj_pd.rolling(**kwds)
self._obj_dd = self._obj_dd.rolling(**{k: v for k, v in kwds.items() if k not in ["on", "closed"]})
def rolling(self, window, min_periods=None, center=False, win_type=None, on=None, axis=0, closed=None):
"""
Create a swifter rolling object
"""
kwds = {
"window": window,
"min_periods": min_periods,
"center": center,
"win_type": win_type,
"on": on,
"axis": axis,
"closed": closed,
}
return Rolling(
self._obj,
self._npartitions,
self._dask_threshold,
self._scheduler,
self._progress_bar,
self._progress_bar_desc,
self._allow_dask_on_strings,
**kwds
)