【问题标题】:pandas profiling import error : not able to import pandas_profiling packagepandas 分析导入错误:无法导入 pandas_profiling 包
【发布时间】:2022-12-21 08:25:44
【问题描述】:

我无法从 pandas.core.base 导入名称 DataError

当我导入包时:

from pandas_profiling import ProfileReport

它显示错误:

cannot import name 'DataError' from 'pandas.core.base'

【问题讨论】:

  • ProfileRreport 中的拼写错误
  • 您使用的是什么版本的 pandas 和 pandas-profiling?
  • 熊猫 1.5.1 熊猫分析 3.2.0

标签: python pandas dataframe pandas-profiling exploratory-data-analysis


【解决方案1】:

导入时有错别字。试试这个:

在 pandas 0.23.0 中,DataError 的导入路径应该是“from pandas.core.base import DataError”。 (资源here

所以使用 Pandas 版本 0.23.0 就可以了

from pandas_profiling import ProfileReport

【讨论】:

  • 仍然面临同样的问题
  • @SaurabhGupta 安装 pandas 0.23.0(pip install pandas==0.23.0),它会工作。此问题是因为在更高版本中 DataError 的路径不同。
【解决方案2】:

新版本的 Python(3.11) 不适用于 pandas_profiling。

旧版本工作正常。

我的工作版本是 3.8.8

和命令行: 将 pandas_profiling 导入为 pp data = pd.read_csv( "-----.csv") pp.ProfileReport(数据)

【讨论】:

    猜你喜欢
    • 2022-08-14
    • 2018-08-25
    • 1970-01-01
    • 2023-02-07
    • 2016-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多