sfu-db / dataprep

Open-source low code data preparation library in python. Collect, clean and visualization your data in python with a few lines of code.
http://dataprep.ai
MIT License
2.07k stars 206 forks source link

replacing np.int and similar aliases to support latest np versions #964

Open rlleshi opened 1 year ago

rlleshi commented 1 year ago

Describe the bug numpy.int, numpy.float, and similar aliases are deprecated since numpy 1.20. As of v1.24, they raise an error.

Was just wondering when is it planned to replace the aliases with the alternatives mentioned in the release notes 1.20?

To Reproduce

from dataprep.eda import *

Throws:

AttributeError                            Traceback (most recent call last)
Cell In[1], line 2
      1 import pandas as pd
----> 2 from dataprep.eda import *
      3 from dataprep.eda import plot, plot_correlation, plot_missing, plot_diff, create_report

File [~/.local/share/virtualenvs/lib/python3.11/site-packages/dataprep/eda/__init__.py:8](https://file+.vscode-resource.vscode-cdn.net/home/rejnald/projects/notebooks/~/.local/share/virtualenvs/recommender-u4VyfX_H/lib/python3.11/site-packages/dataprep/eda/__init__.py:8)
      5 from bokeh.io import output_notebook
      7 from ..utils import is_notebook
----> 8 from .correlation import compute_correlation, plot_correlation, render_correlation
      9 from .create_report import create_report
     10 from .create_diff_report import create_diff_report

File [~/.local/share/virtualenvs/recommender-u4VyfX_H/lib/python3.11/site-packages/dataprep/eda/correlation/__init__.py:13](https://file+.vscode-resource.vscode-cdn.net/home/rejnald/projects/recommender/notebooks/~/.local/share/virtualenvs/recommender-u4VyfX_H/lib/python3.11/site-packages/dataprep/eda/correlation/__init__.py:13)
     11 from ..container import Container
     12 from ...progress_bar import ProgressBar
---> 13 from .compute import compute_correlation
     14 from .render import render_correlation
     16 __all__ = ["render_correlation", "compute_correlation", "plot_correlation"]

File [~/.local/share/virtualenvs/recommender-u4VyfX_H/lib/python3.11/site-packages/dataprep/eda/correlation/compute/__init__.py:8](https://file+.vscode-resource.vscode-cdn.net/home/rejnald/projects/recommender/notebooks/~/.local/share/virtualenvs/recommender-u4VyfX_H/lib/python3.11/site-packages/dataprep/eda/correlation/compute/__init__.py:8)
      5 from warnings import catch_warnings, filterwarnings
      7 from ...configs import Config
----> 8 from ...intermediate import Intermediate
...

AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
vtharmalingam commented 1 year ago

This has totally blocked my trying out this beautiful & promising solution on my env wherein I had to hard fix py3.11 and given pandas and numpy versions. Hope this gets resolved soon!!