1
1
---
2
- title : Thresholds
2
+ title : Setting Failure Thresholds
3
3
jupyter : python3
4
4
html-table-processing : none
5
5
---
@@ -27,10 +27,8 @@ particular column):
27
27
import pointblank as pb
28
28
29
29
validation_1 = (
30
- pb.Validate(data=pb.load_dataset(dataset="small_table"))
31
- .col_vals_not_null(
32
- columns="c", thresholds=(1, 0.2)
33
- )
30
+ pb.Validate(data=pb.load_dataset(dataset="small_table", tbl_type="polars"))
31
+ .col_vals_not_null(columns="c", thresholds=(1, 0.2))
34
32
.interrogate()
35
33
)
36
34
@@ -61,14 +59,17 @@ with a value of `5`, then 5 failing test units will result in an exceedance.
61
59
62
60
## Using the ` Validation(thresholds=) ` Argument
63
61
64
- We can also define thresholds globally. This means that every validation step will re-use the same
65
- set of threshold values.
62
+ We can also define thresholds globally (within the ` Validate ` call) . This means that every
63
+ validation step will re-use the same set of threshold values.
66
64
67
65
``` python
68
66
import pointblank as pb
69
67
70
68
validation_2 = (
71
- pb.Validate(data = pb.load_dataset(dataset = " small_table" ), thresholds = (1 , 0.1 ))
69
+ pb.Validate(
70
+ data = pb.load_dataset(dataset = " small_table" , tbl_type = " polars" ),
71
+ thresholds = (1 , 0.1 )
72
+ )
72
73
.col_vals_not_null(columns = " a" )
73
74
.col_vals_gt(columns = " b" , value = 2 )
74
75
.interrogate()
@@ -82,7 +83,7 @@ and [`col_vals_gt()`](https://posit-dev.github.io/pointblank/reference/Validate.
82
83
steps will use the ` thresholds= ` value set in the
83
84
[ ` Validate ` ] ( https://posit-dev.github.io/pointblank/reference/Validate.html ) call. Now, if you want
84
85
to override these global threshold values for a given validation step, you can always use the
85
- ` threshold =` argument when calling a validation method (this argument is present within every
86
+ ` thresholds =` argument when calling a validation method (this argument is present within every
86
87
validation method).
87
88
88
89
## Ways to Define Thresholds
@@ -120,7 +121,7 @@ express thresholds without these constraints.
120
121
121
122
Using the [ ` Thresholds ` ] ( https://posit-dev.github.io/pointblank/reference/Thresholds.html ) class
122
123
lets you define the threshold levels using the ` warning= ` , ` error= ` , and ` critical= ` arguments. And
123
- unlike the method of setting thresholds with a tuple, any of the threshold levels can be unset.
124
+ unlike the method of setting thresholds with a tuple, any of the threshold levels can be left unset.
124
125
Here's an example where you might want to set the 'error' and 'critical' levels (leaving the
125
126
'warning' level unset):
126
127
0 commit comments