Validate.get_tabular_report

Validate.get_tabular_report(title=':default:')

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.

import pointblank as pb
import polars as pl

# Create a Polars DataFrame
tbl_pl = pl.DataFrame({"x": [1, 2, 3, 4], "y": [4, 5, 6, 7]})

# Validate data using Polars DataFrame
validation = (
    pb.Validate(data=tbl_pl, tbl_name="tbl_xy", thresholds=(2, 3, 4))
    .col_vals_gt(columns="x", value=1)
    .col_vals_lt(columns="x", value=3)
    .col_vals_le(columns="y", value=7)
    .interrogate()
)

# Look at the validation table
validation
Pointblank Validation
2024-12-20|15:08:44
Polarstbl_xyWARN2STOP3NOTIFY4
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W S N EXT
#4CA64C66 1
col_vals_gt
col_vals_gt()
x 1 4 3
0.75
1
0.25
#FFBF00 2
col_vals_lt
col_vals_lt()
x 3 4 2
0.50
2
0.50
#4CA64C 3
col_vals_lte
col_vals_le()
y 7 4 4
1.00
0
0.00
2024-12-20 15:08:44 UTC< 1 s2024-12-20 15:08:44 UTC

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.

validation.get_tabular_report(title=":tbl_name:")
tbl_xy
2024-12-20|15:08:44
Polarstbl_xyWARN2STOP3NOTIFY4
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W S N EXT
#4CA64C66 1
col_vals_gt
col_vals_gt()
x 1 4 3
0.75
1
0.25
#FFBF00 2
col_vals_lt
col_vals_lt()
x 3 4 2
0.50
2
0.50
#4CA64C 3
col_vals_lte
col_vals_le()
y 7 4 4
1.00
0
0.00
2024-12-20 15:08:44 UTC< 1 s2024-12-20 15:08:44 UTC

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.

validation.get_tabular_report(title="Report for Table XY")

Report for Table XY

2024-12-20|15:08:44
Polarstbl_xyWARN2STOP3NOTIFY4
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W S N EXT
#4CA64C66 1
col_vals_gt
col_vals_gt()
x 1 4 3
0.75
1
0.25
#FFBF00 2
col_vals_lt
col_vals_lt()
x 3 4 2
0.50
2
0.50
#4CA64C 3
col_vals_lte
col_vals_le()
y 7 4 4
1.00
0
0.00
2024-12-20 15:08:44 UTC< 1 s2024-12-20 15:08:44 UTC

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.