由于错误"无法导入名称"DataError' from 'pandas.core.base'",无法导入熊猫分析无法导入



我今天刚刚将Python升级到3.11。Pandas-profiling以前工作得很好,但现在由于以下错误,我似乎无法导入它:

cannot import name 'DataError' from 'pandas.core.base' (C:UsersUser_nameAppDataLocalProgramsPythonPython311Libsite-packagespandascorebase.py)

有什么帮助我可以解决这个问题吗?

这是我的代码:

import pandas as pd
from pandas_profiling import ProfileReport

Pandas版本- 1.5.2熊猫分析版本- 3.2.0

弃用时间表

  • ydata-profiling于2月1日启动。

  • pip install pandas-profiling在4月1日之前仍然支持。但是会发出警告。从pandas_profiling导入ProfileReport";将支持到4月1日。

  • 4月1日以后,如果安装pip会抛出错误使用熊猫分析。请使用pip install ydata-profiling。

  • 4月1日之后,如果从pandas_profiling将抛出一个错误import ProfileReport。从ydata_profiling导入使用ProfileReport。

经过更多的研究,我认为这是新版本python(3.11)的一个问题。我重新安装了python 3.10(.9), pandas_profiling工作得很好。

在Jupyter notebook中从cmd shell运行这个不同版本的python的代码是:

C:UsersUser_nameYour_path_to_pythonPythonPython310python.exe -m notebook

那么就正常使用pandas_profiling。如果有人有任何建议让它在python v3.11上工作,请告诉我。

您只需要安装ydata_profiling包和pandas_profiling;之后,输入:

from pandas_profiling import ProfileReport

那你就可以走了。

相关内容

最新更新