JT_uhmbt
JT_uhmbt

Reputation: 101

Pandas profiling not able to import due to error 'cannot import name "DataError' from 'pandas.core.base'"

I have just upgraded Python to 3.11 today. Pandas-profiling worked fine before, but now I cannot seem to import it due to the following error:

cannot import name 'DataError' from 'pandas.core.base' (C:\Users\User_name\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\base.py)

Any help as to how I can fix this?

This is my code:

import pandas as pd
from pandas_profiling import ProfileReport

Pandas version - 1.5.2 Pandas-profiling version - 3.2.0

Upvotes: 8

Views: 21328

Answers (4)

Tahir Yamin
Tahir Yamin

Reputation: 1

Update Version as of 2024:

import pandas as pd
import ydata_profiling as pp

pandas_profiling is no longer maintained: https://pypi.org/project/pandas-profiling/. Instead, according to the instructions, you should use ydata_profiling.

Upvotes: 0

Abhishek Kumar singh
Abhishek Kumar singh

Reputation: 31

You need to simply install the ydata_profiling package and also pandas_profiling; after that, type:

from pandas_profiling import ProfileReport

Then you are good to go.

Upvotes: 3

Taresh Gupta
Taresh Gupta

Reputation: 61

Schedule for deprecation

  • ydata-profiling was launched in February 1st.

  • pip install pandas-profiling will still be supported until April 1st, but a warning will be thrown. "from pandas_profiling import ProfileReport " will be supported until April 1st.

  • After April 1st, an error will be thrown if pip install pandas-profiling is used. Use pip install ydata-profiling instead.

  • After April 1st, an error will be thrown if from pandas_profiling import ProfileReport is used. Use from ydata_profiling import ProfileReport instead.

Upvotes: 5

JT_uhmbt
JT_uhmbt

Reputation: 101

After more research, I think this is an issue with the new version of python (3.11). I re-installed python 3.10(.9) and pandas_profiling works perfectly fine.

The code to run this different version of python in Jupyter notebook from cmd shell is:

C:\Users\User_name\Your_path_to_python\Python\Python310\python.exe -m notebook

Then just use pandas_profiling normally. If anyone has any suggestions to get it working on python v3.11, let me know.

Upvotes: 2

Related Questions