has_no_nulls
checks.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
Type | Description |
---|---|
PolarsLazyOrDataFrame | The original polars DataFrame or LazyFrame when the check passes |
Examples
>>> import polars as pl
>>> from pelage import checks
>>> df = pl.DataFrame({
"A": [1, 2],
... "B": [None, 5]
...
... })>>> df
2, 2)
shape: (
┌─────┬──────┐
│ A ┆ B │--- ┆ --- │
│
│ i64 ┆ i64 │
╞═════╪══════╡1 ┆ null │
│ 2 ┆ 5 │
│
└─────┴──────┘>>> checks.has_no_nulls(df)
Traceback (most recent call last):
...
pelage.checks.PolarsAssertError: Details1, 2)
shape: (
┌────────┬────────────┐
│ column ┆ null_count │--- ┆ --- │
│ str ┆ u32 │
│
╞════════╪════════════╡1 │
│ B ┆
└────────┴────────────┘with the DataFrame passed to the check function:
Error -->There were unexpected nulls in the columns above