Skip to content

Commit 2400379

Browse files
committed
Update col_pct_null() examples for clarity
1 parent 4ddbf05 commit 2400379

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pointblank/validate.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9961,7 +9961,7 @@ def col_pct_null(
99619961
different ways to specify tolerance using column `b`, which has exactly 50% Null values
99629962
(4 out of 8 values).
99639963

9964-
**Using an absolute tolerance (integer)**: Specify the exact number of rows that can
9964+
*Using an absolute tolerance (integer)*: Specify the exact number of rows that can
99659965
deviate. With `tol=1`, we allow the count to differ by 1 row in either direction.
99669966

99679967
```{python}
@@ -9977,7 +9977,7 @@ def col_pct_null(
99779977
This passes because column `b` has 4 Null values, which falls within the acceptable range
99789978
of 2 to 4 (3 ± 1).
99799979

9980-
**Using a relative tolerance (float)**: Specify the tolerance as a proportion of the
9980+
*Using a relative tolerance (float)*: Specify the tolerance as a proportion of the
99819981
expected count. With `tol=0.25`, we allow a 25% deviation from the expected count.
99829982

99839983
```{python}
@@ -9990,17 +9990,17 @@ def col_pct_null(
99909990
validation
99919991
```
99929992

9993-
This passes because 4 Null values falls within the acceptable range (3 ± 0.75, which is
9994-
2.25 to 3.75).
9993+
This passes because 4 Null values falls within the acceptable range (3 ± 0.75 calculates
9994+
to 2.25 to 3.75, which rounds down to 2 to 3 rows).
99959995

9996-
**Using asymmetric absolute bounds (tuple of integers)**: Specify different lower and
9996+
*Using asymmetric absolute bounds (tuple of integers)*: Specify different lower and
99979997
upper bounds as absolute values. With `tol=(0, 2)`, we allow no deviation below but up
99989998
to 2 rows above the expected count.
99999999

1000010000
```{python}
1000110001
validation = (
1000210002
pb.Validate(data=tbl)
10003-
.col_pct_null(columns="b", p=0.25, tol=(0, 2) # Expect 2 nulls, allow +0/-2 (range: 2-4)
10003+
.col_pct_null(columns="b", p=0.25, tol=(0, 2)) # Expect 2 Nulls, allow +0/-2 (range: 2-4)
1000410004
.interrogate()
1000510005
)
1000610006

@@ -10009,22 +10009,22 @@ def col_pct_null(
1000910009

1001010010
This passes because 4 Null values falls within the acceptable range of 2 to 4.
1001110011

10012-
**Using asymmetric relative bounds (tuple of floats)**: Specify different lower and upper
10012+
*Using asymmetric relative bounds (tuple of floats)*: Specify different lower and upper
1001310013
bounds as proportions. With `tol=(0.1, 0.3)`, we allow 10% below and 30% above the
1001410014
expected count.
1001510015

1001610016
```{python}
1001710017
validation = (
1001810018
pb.Validate(data=tbl)
10019-
.col_pct_null(columns="b", p=0.375, tol=(0.1, 0.3) # Expect 3 nulls, allow -10%/+30%
10019+
.col_pct_null(columns="b", p=0.375, tol=(0.1, 0.3) # Expect 3 Nulls, allow -10%/+30%
1002010020
.interrogate()
1002110021
)
1002210022

1002310023
validation
1002410024
```
1002510025

10026-
This passes because 4 Null values falls within the acceptable range (3 - 0.3 to 3 + 0.9,
10027-
which is 2.7 to 3.9).
10026+
This passes because 4 Null values falls within the acceptable range (3 - 0.3 to 3 + 0.9
10027+
calculates to 2.7 to 3.9, which rounds down to 2 to 3 rows).
1002810028
"""
1002910029
assertion_type = _get_fn_name()
1003010030

0 commit comments

Comments
 (0)