Skip to content

swifter.rolling uses the axis kwarg, which no longer exists in Dask #233

@Andrew5057

Description

@Andrew5057

swifter.rolling passes "axis" as a kwarg to the Dask implementation of rolling. This appears to make swifter.rolling unusable, as the "axis" kwarg was deprecated with pandas>=2.1. (See the Dask docs.)

Even basic uses throw an error:

import pandas as pd
import swifter

df_pd = pd.DataFrame({"a": [0, 1, 2], "b": [0, 1, 2]})

print(df_pd.swifter.rolling(1))
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/anerdw/stackoverflow/stuff.py", line 6, in <module>
    print(df_pd.swifter.rolling(1))
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anerdw/stackoverflow/env/lib/python3.11/site-packages/swifter/swifter.py", line 162, in rolling
    return Rolling(
           ^^^^^^^^
  File "/home/anerdw/stackoverflow/env/lib/python3.11/site-packages/swifter/swifter.py", line 737, in __init__
    self._obj_dd = self._obj_dd.rolling(**{k: v for k, v in kwds.items() if k not in ["on", "closed"]})
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anerdw/stackoverflow/env/lib/python3.11/site-packages/dask_expr/_collection.py", line 976, in rolling
    return Rolling(self, window, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Rolling.__init__() got an unexpected keyword argument 'axis'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions