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

Replace pdvega with Holoviews for Compatibility with Pandas Version >= 2.0.0 #238

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DanielBrkr
Copy link

Hi there!

TL;DR

I noticed that pdvega/vgplot no longer compatible with pandas and replaced it with the corresponding holoviews pieces since this looks to me like the most reasonable alternative to pdvega right now.
(holoviews allows interactiv plotting and multiple backends like matplotlib or plotly).

You might need to take a look at the notebook outputs with nbviewer, github doesn't render the holoviews output in preview mode:
https://github.com/DanielBrkr/eicu-code/tree/replace-pdvega/notebooks

Details

Here's an example of the portions that cause errors:

df[['data completion']].vgplot.hist(bins=10,  
                                    var_name='Number of hospitals',  
                                    value_name='Percent of patients with data')

Traceback:

AttributeError: module 'pandas.core' has no attribute 'index'

.
.
.

File ~\AppData\Local\pypoetry\Cache\virtualenvs\eicu-code-BSlVd4Lx-py3.11\Lib\site-packages\vega3\utils.py:40, in sanitize_dataframe(df)
     36 import numpy as np
     38 df = df.copy()
---> 40 if isinstance(df.index, pd.core.index.MultiIndex):
     41     raise ValueError('Hierarchical indices not supported')
     42 if isinstance(df.columns, pd.core.index.MultiIndex):

Deprecation in
pandas-dev/pandas#30193 (2019)

and removal of pandas.core.index in Version 2.0.0 (April 2023)
https://pandas.pydata.org/docs/dev/whatsnew/v2.0.0.html#removal-of-prior-version-deprecations-changes

Removed deprecated module pandas.core.index (GH 30193)

pdvega is no longer developed since June 2020 other than that so i think it's a good idea to replace it anyway.

Feel free to merge it if it's any help and let me know if I need to change anything !

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

Successfully merging this pull request may close these issues.

1 participant