Skip to content

Commit ca1a414

Browse files
committed
Add examples to missing_vals_tbl() function
1 parent f7035ca commit ca1a414

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pointblank/validate.py

+20
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,26 @@ def missing_vals_tbl(data: FrameT | Any) -> GT:
849849
rows, and so on. Any sectors that are light blue indicate that there are no missing values in
850850
that sector. If there are missing values, the proportion of missing values is shown by a gray
851851
color (light gray for low proportions, dark gray to black for very high proportions).
852+
853+
Examples
854+
--------
855+
The `missing_vals_tbl()` function is useful for quickly identifying columns with missing values
856+
in a table. Here's an example using the `nycflights` dataset (loaded using the `load_dataset()`
857+
function as a Polars DataFrame):
858+
859+
```{python}
860+
import pointblank as pb
861+
862+
nycflights = pb.load_dataset("nycflights", tbl_type="polars")
863+
864+
pb.missing_vals_tbl(nycflights)
865+
```
866+
867+
The table shows the proportion of missing values in each column of the `nycflights` dataset. The
868+
table is divided into sectors, with each sector representing a range of rows in the table (with
869+
around 34,000 rows per sector). The proportion of missing values in each sector is calculated
870+
for each column. The various shades of gray indicate the proportion of missing values in each
871+
sector. Many columns have no missing values at all, and those sectors are colored light blue.
852872
"""
853873

854874
# Make a copy of the data to avoid modifying the original

0 commit comments

Comments
 (0)