has_no_nulls
has_no_nulls(data, columns=None)Check if a DataFrame has any null (missing) values.
Parameters
data: PolarsLazyOrDataFrame-
The input DataFrame to check for null values.
columns: Optional[PolarsColumnType] = None-
Columns to consider for null value check. By default, all columns are checked.
Returns
| Name | Type | Description |
|---|---|---|
| PolarsLazyOrDataFrame | The original polars DataFrame or LazyFrame when the check passes |
Examples
>>> import polars as pl
>>> import pelage as plg
>>> df = pl.DataFrame({
... "A": [1, 2],
... "B": [None, 5]
... })
>>> df
shape: (2, 2)
┌─────┬──────┐
│ A ┆ B │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪══════╡
│ 1 ┆ null │
│ 2 ┆ 5 │
└─────┴──────┘
>>> df.pipe(plg.has_no_nulls)
Traceback (most recent call last):
...
pelage.types.PolarsAssertError: Details
shape: (1, 2)
┌────────┬────────────┐
│ column ┆ null_count │
│ --- ┆ --- │
│ str ┆ u32 │
╞════════╪════════════╡
│ B ┆ 1 │
└────────┴────────────┘
Error with the DataFrame passed to the check function:
--> There were unexpected nulls in the columns above