Skip to content

Commit 31bf337

Browse files
committed
Add Pointblank example validation
1 parent cc33338 commit 31bf337

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/blog/survey-validation-libs/index.qmd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,26 @@ Pointblank launched with Polars support as a core feature from its initial Pytho
122122
2024, built on top of the Narwhals and Ibis compatibility layers to provide consistent DataFrame
123123
operations across multiple backends including Polars, Pandas, and database connections.
124124

125+
```{python}
126+
import pointblank as pb
127+
128+
schema = pb.Schema(
129+
columns=[("user_id", "Int64"), ("age", "Int64"), ("email", "String"), ("score", "Float64")]
130+
)
131+
132+
validation = (
133+
pb.Validate(data=user_data, label="An example.", tbl_name="users", thresholds=(0.1, 0.2, 0.3))
134+
.col_vals_gt(columns="user_id", value=0)
135+
.col_vals_between(columns="age", left=18, right=80)
136+
.col_vals_regex(columns="email", pattern=r"^[^@]+@[^@]+\.[^@]+$")
137+
.col_vals_between(columns="score", left=0, right=100)
138+
.col_schema_match(schema=schema)
139+
.interrogate()
140+
)
141+
142+
validation
143+
```
144+
125145
## 4. Validoopsie: Composable Checks
126146

127147
Validoopsie is built around composable validation principles, providing a toolkit for creating

0 commit comments

Comments
 (0)