import pointblank as pb
import polars as pl
# Create a Polars DataFrame
= pl.DataFrame({"x": [1, 2, 3, 4], "y": [4, 5, 6, 7]})
tbl_pl
# Validate data using Polars DataFrame
= (
validation =tbl_pl, tbl_name="tbl_xy", thresholds=(2, 3, 4))
pb.Validate(data="x", value=1)
.col_vals_gt(columns="x", value=3)
.col_vals_lt(columns="y", value=7)
.col_vals_le(columns
.interrogate()
)
# Look at the validation table
validation
Validate.get_tabular_report
=':default:') Validate.get_tabular_report(title
Validation report as a GT table.
The get_tabular_report()
method returns a GT table object that represents the validation report. This validation table provides a summary of the validation results, including the validation steps, the number of test units, the number of failing test units, and the fraction of failing test units. The table also includes status indicators for the warn
, stop
, and notify
levels.
You could simply display the validation table without the use of the get_tabular_report()
method. However, the method provides a way to customize the title of the report. In the future this method may provide additional options for customizing the report.
Parameters
title : str | None = ':default:'
-
Options for customizing the title of the report. The default is the
":default:"
value which produces a generic title. Another option is":tbl_name:"
, and that presents the name of the table as the title for the report. If no title is wanted, then":none:"
can be used. Aside from keyword options, text can be provided for the title. This will be interpreted as Markdown text and transformed internally to HTML.
Returns
: GT
-
A GT table object that represents the validation report.
Examples
Let’s create a Validate
object with a few validation steps and then interrogate the data table to see how it performs against the validation plan. We can then generate a tabular report to get a summary of the results.
The validation table is displayed with a default title (‘Validation Report’). We can use the get_tabular_report()
method to customize the title of the report. For example, we can set the title to the name of the table by using the title=":tbl_name:"
option. This will use the string provided in the tbl_name=
argument of the Validate
object.
=":tbl_name:") validation.get_tabular_report(title
The title of the report is now set to the name of the table, which is ‘tbl_xy’. This can be useful if you have multiple tables and want to keep track of which table the validation report is for.
Alternatively, you can provide your own title for the report.
="Report for Table XY") validation.get_tabular_report(title
The title of the report is now set to ‘Report for Table XY’. This can be useful if you want to provide a more descriptive title for the report.