Pointblank Validation | |||||||||||||
2025-01-20|18:18:04 Polars |
|||||||||||||
STEP | COLUMNS | VALUES | TBL | EVAL | UNITS | PASS | FAIL | W | S | N | EXT | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
#4CA64C | 1 |
|
✓ | 1 | 1 1.00 |
0 0.00 |
— | — | — | — | |||
#4CA64C | 2 |
|
✓ | 13 | 13 1.00 |
0 0.00 |
— | — | — | — | |||
2025-01-20 18:18:04 UTC< 1 s2025-01-20 18:18:04 UTC |
Mutate the Table in a Validation Step
For far more specialized validations, modify the table with the pre=
argument before checking it.
import pointblank as pb
import polars as pl
import narwhals as nw
= (
validation
pb.Validate(=pb.load_dataset(dataset="small_table", tbl_type="polars")
data
)
.col_vals_between(="a",
columns=3, right=6,
left=lambda df: df.select(pl.median("a")) # Use a Polars expression to aggregate
pre
)
.col_vals_eq(="b_len",
columns=9,
value=lambda dfn: dfn.with_columns( # Use a Narwhals expression, identified
pre=nw.col("b").str.len_chars() # by the 'dfn' here
b_len
)
)
.interrogate()
)
validation
Preview of Input Table
PolarsRows13Columns8 |
||||||||