PyCaret Setup函数Profile属性失效:加载后报告未出现求助
PyCaret 3.3.2中
setup函数profile=True无报告显示的解决办法 环境信息
- Python版本:3.9.19
- PyCaret版本:3.3.2
问题复现
执行以下代码:
import pycaret print(pycaret.__version__) # 输出 '3.3.2' ClassificationSetup = setup(data = data, target = 'class', session_id=42, profile=True)
仅显示Loading profile... Please wait!,预期包含重复值、空值、相关性、直方图等内容的数据概览报告始终未出现。
解决步骤
验证并安装依赖库
PyCaret的profile功能依赖ydata-profiling,确认已安装兼容版本:pip install ydata-profiling>=4.0.0已安装则尝试升级:
pip install --upgrade ydata-profiling检查Jupyter环境(若在Notebook运行)
重启Jupyter内核,确保内核正常连接且允许渲染HTML内容,重新运行代码。手动生成报告
若自动加载失败,直接调用ydata-profiling生成并查看报告:from ydata_profiling import ProfileReport profile = ProfileReport(data, title="Data Profiling Report") # 在Notebook内显示 profile.to_notebook_iframe() # 保存为HTML文件本地查看 profile.to_file("data_profile.html")测试数据子集
若数据集过大,生成报告耗时过长会导致无响应,先测试数据子集:sample_data = data.sample(n=1000, random_state=42) ClassificationSetup = setup(data = sample_data, target = 'class', session_id=42, profile=True)
内容的提问来源于stack exchange,提问作者Samuel Vasco
相关产品推荐
相关产品推荐

