【问题标题】:Pandas Profiling - KeyError: 'Requested level (var1) does not match index name (None)'Pandas 分析 - KeyError:“请求的级别(var1)与索引名称(无)不匹配”
【发布时间】:2020-11-01 07:23:06
【问题描述】:

我收到KeyError: 'Requested level (var1) does not match index name (None)'。 , 运行下面的代码。

pandas_profiling 版本 = 2.8.0

代码:

Profile = df_NYC.profile_report(title = "NYC Flight Data Profiling before Pre-processing")

错误信息:

~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in _validate_index_level(self, level)
   1414         elif level != self.name:
   1415             raise KeyError(
-> 1416                 f"Requested level ({level}) does not match index name ({self.name})"
   1417             )
   1418 
KeyError: 'Requested level (var1) does not match index name (None)'

我不确定如何解决这个问题?有人可以帮忙吗?

提前感谢您的帮助!

【问题讨论】:

    标签: python pandas indexing keyerror pandas-profiling


    【解决方案1】:

    我在运行 pandas-profiling 2.3.0 版时看到了这个错误,但升级到 2.8.0 版后它就消失了。我不知道你是否也在使用 pycaret,但是当我安装 pycaret 版本 1.0.0 时,它会将 pandas-profiling 的版本从 2.8.0 降级到 2.3.0。我在安装 pycaret 后通过“pip freeze/conda list”确认了这一点。

    不幸的是,这意味着我只能安装 pandas-profiling v2.8.0 或 pycaret v1.0.0,所以我使用两个单独的 virtualenvs 来分离这两个包。但我不再看到此错误。

    【讨论】:

    • 非常感谢,将我的 pandas-profiling 升级到 2.8.0 版后它运行良好
    猜你喜欢
    • 1970-01-01
    • 2016-02-21
    • 1970-01-01
    • 2018-09-11
    • 2022-10-06
    • 2014-07-30
    • 2018-12-16
    • 1970-01-01
    • 2018-02-03
    相关资源
    最近更新 更多