更改设置
可以通过三种方式更改 available_settings
中列出的设置
通过代码
配置示例 |
---|
| # Create the ProfileReport object without specifying a DataFrame
profile = df.profile_report(title="Profiling Report", pool_size=1)
# Change the configuration as desired
profile.config.html.minify_html = False
# Specify a DataFrame and trigger the report's computation
profile.to_file("output.html")
|
一些相关的设置被分组到配置简写中,这使得可以选择性地启用或禁用报告的某些部分或功能
samples
:控制是否显示数据集预览。
correlation
:控制是否执行相关性计算。
missing_diagrams
:控制是否执行缺失值分析。
duplicates
:控制是否预览重复行。
interactions
:控制是否计算交互。
一次性禁用样本预览、相关性、缺失值图表和重复行 |
---|
| r = ProfileReport(
samples=None,
correlations=None,
missing_diagrams=None,
duplicates=None,
interactions=None,
)
|
通过自定义配置文件
要通过自定义文件控制 ydata-profiling
,可以从下面的示例配置文件之一开始
根据需要更改配置,并在计算报告时指向该配置文件
自定义配置文件 |
---|
| from ydata_profiling import ProfileReport
profile = ProfileReport(df, config_file="your_config.yml")
profile.to_file("report.html")
|
通过环境变量
任何配置设置也可以从环境变量中读取。例如
使用参数设置报告标题 |
---|
| from ydata_profiling import ProfileReport
profile = ProfileReport(df, title="My Custom Profiling Report")
|
等同于将标题设置为环境变量
通过环境变量设置标题 |
---|
| import os
from ydata_profiling import ProfileReport
os.environ("PROFILE_TITLE")='My Custom Profiling Report'
profile = ProfileReport(df)
|
