Pandas 分析导入错误:无法从“markupsafe”导入名称“soft_unicode”

Kus*_*ama 5 python profiling pandas

我在开始进行 pandas 分析时遇到问题。

我尝试加载 pandas 分析,但安装时弹出此错误:

错误:pip 的依赖项解析器当前未考虑所有已安装的软件包。此行为是以下依赖性冲突的根源。anaconda-project 0.9.1 需要 ruamel-yaml,但未安装。sphinx 4.0.1 需要 MarkupSafe<2.0,但您有 markupsafe 2.1.1,这是不兼容的。

我尝试通过安装早期版本来修复它。但是,如果我按照指示安装低于 2.0 的 MarkupSafe 版本,则会收到以下错误:

pandas-profiling 3.2.0 需要 markupsafe~=2.1.1,但你有 markupsafe 2.0.1,这是不兼容的

现在,如果我只是尝试使用 pandas 分析,我会收到错误:

无法从“markupsafe”导入名称“soft_unicode”

这是我使用的代码:

from pandas_profiling import ProfileReport
import pandas as pd

df = pd.read_excel("WBNAME", sheetname = None)
prof = ProfileReport(df)
prof.to_file(output_file='output.html') 
Run Code Online (Sandbox Code Playgroud)

我到底应该做什么才能使用 pandas 分析?

小智 0

尝试下面几行,也许有效

import pandas_profiling as pp
df = pd.read_excel("WBNAME", sheetname = None)
profile= pp.ProfileReport(df)
profile.to_file('pandas_profile_test.html')
Run Code Online (Sandbox Code Playgroud)