| Pointblank Validation | |||||||||||||
2025-10-29|23:16:07 Polars |
|||||||||||||
| STEP | COLUMNS | VALUES | TBL | EVAL | UNITS | PASS | FAIL | W | E | C | EXT | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| #4CA64C | 1 |
col_vals_between()
|
✓ | 1 | 1 1.00 |
0 0.00 |
— | — | — | — | |||
| #4CA64C | 2 |
col_vals_eq()
|
✓ | 13 | 13 1.00 |
0 0.00 |
— | — | — | — | |||
2025-10-29 23:16:07 UTC< 1 s2025-10-29 23:16:07 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
# Define preprocessing functions
def get_median_a(df):
"""Use a Polars expression to aggregate column `a`."""
return df.select(pl.median("a"))
def add_b_length_column(df):
"""Use Narwhals to add a string length column `b_len`."""
return (
nw.from_native(df)
.with_columns(b_len=nw.col("b").str.len_chars())
)
validation = (
pb.Validate(
data=pb.load_dataset(dataset="small_table", tbl_type="polars")
)
.col_vals_between(
columns="a",
left=3, right=6,
pre=get_median_a
)
.col_vals_eq(
columns="b_len",
value=9,
pre=add_b_length_column
)
.interrogate()
)
validationPreview of Input Table
PolarsRows13Columns8 |
||||||||