Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Andrew5057 opened this issue Sep 2, 2024 · 1 comment
Open

Comments

@Andrew5057
Copy link

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'
@Harsh-Maheshwari
Copy link

Any workaround for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants