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

Error with Pandas version 2 #3

Open
davideyre opened this issue May 24, 2023 · 4 comments
Open

Error with Pandas version 2 #3

davideyre opened this issue May 24, 2023 · 4 comments

Comments

@davideyre
Copy link

  • comorbidipy version: 0.5.0
  • Python version: 3.9.6
  • Operating System: macOS

Description

Comorbidipy works fine with pandas 1.4.0, but when trying to run with a more recent version I get this error, e.g. version 1.5.0 or version 2.0.1

Traceback (most recent call last):
  File "main.py", line 7, in <module>
    from comorbidipy import comorbidity
  File "venv/lib/python3.9/site-packages/comorbidipy/__init__.py", line 7, in <module>
    from .calculator import comorbidity, hfrs, disability
  File "venv/lib/python3.9/site-packages/comorbidipy/calculator.py", line 5, in <module>
    from pandas.core.common import SettingWithCopyWarning
ImportError: cannot import name 'SettingWithCopyWarning' from 'pandas.core.common' (venv/lib/python3.9/site-packages/pandas/core/common.py)

The issue seems to be that the import is now in pandas.errors, this doesn't work -

from pandas.core.common import SettingWithCopyWarning

But this does

 from pandas.errors import SettingWithCopyWarning
@Padmapalita
Copy link

Upvoting this issue.

@rbngz
Copy link

rbngz commented Jul 25, 2023

It seems to be fixed with the recent commit but has not yet been published to PyPi.
Simply install from Github using the commit hash:

pip install git+https://github.com/vvcb/comorbidipy.git@c676a8067ce343704d75bcf8180f9baa1ac47664

Make sure to uninstall any previous version first using

pip uninstall comorbidipy

@smgpulse007
Copy link

Goto calculator.py
~AppData\Local\Programs\Python\Python311\Lib\site-packages\comorbidipy

Change from pandas.core.common import SettingWithCopyWarning

TO
from pandas.errors import SettingWithCopyWarning

@vvcb This fixes the issue and the import works as described in the docs

@MattStammers
Copy link

It seems to be fixed with the recent commit but has not yet been published to PyPi. Simply install from Github using the commit hash:

pip install git+https://github.com/vvcb/comorbidipy.git@c676a8067ce343704d75bcf8180f9baa1ac47664

Make sure to uninstall any previous version first using

pip uninstall comorbidipy

@rbngz is right. @vvcb you need to patch the current pypi version.

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

5 participants