profile_report
¶
The ProfileReport: profile a Polars frame and render it.
Classes¶
ProfileReport
¶
Bases: SerializeReport
A profile report of a Polars DataFrame or LazyFrame.
Statistics are computed when the report (or its description) is first
needed, by a handful of batched lazy queries. A LazyFrame (for example
from pl.scan_parquet) is never collected whole.
Used as is, it outputs its content as an HTML report in a Jupyter notebook.
Methods:¶
invalidate_cache(subset=None)
¶
Invalidate report cache. Useful after changing setting.
Args: subset: - "rendering" to invalidate the html, json and widget report rendering - "report" to remove the caching of the report structure - None (default) to invalidate all caches
get_duplicates()
¶
Get duplicate rows and counts based on the configuration
Returns: A DataFrame with the duplicate rows and their counts.
get_sample()
¶
Get head/tail samples based on the configuration
Returns:
The samples, each with its rows as a pl.DataFrame in data.
get_description()
¶
Return the description (a raw statistical summary) of the dataset.
Returns: The description, with a summary dict for each variable.
get_rejected_variables()
¶
Get variables that are rejected for analysis (e.g. constant, mixed data types)
Returns: a set of column names that are unsupported
to_file(output_file, silent=True)
¶
Write the report to a file.
Args: output_file: The name or the path of the file to generate including the extension (.html, .json). silent: if False, opens the file in the default browser or download it in a Google Colab environment
to_html()
¶
Generate and return complete template as lengthy string for using with frameworks.
Returns: Profiling report html including wrapper.
to_json()
¶
Represent the ProfileReport as a JSON string
Returns: JSON string
to_notebook_iframe()
¶
Used to output the HTML representation to a Jupyter notebook.
When config.notebook.iframe.attribute is "src", this function creates a temporary HTML file
in ./tmp/profile_[hash].html and returns an Iframe pointing to that contents.
When config.notebook.iframe.attribute is "srcdoc", the same HTML is injected in the "srcdoc" attribute of
the Iframe.
Notes: This constructions solves problems with conflicting stylesheets and navigation links.
to_widgets()
¶
The ipython notebook widgets user interface.
compare(other, config=None)
¶
Compare this report with another ProfileReport
Alias for polars_data_profiling.compare([report1, report2], config=config).
Args:
other: the ProfileReport to compare to
config: the settings object for the merged ProfileReport. If None, uses the caller's config
Returns: Comparison ProfileReport