has_no_infs
checks.has_no_infs(data, columns=None)
Check if a DataFrame has any infinite (inf) 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
>>> import pelage as plg
>>> df = pl.DataFrame(
... {"a": [1, 2],
... "b": [1.0, float("inf")],
...
... }
... )>>> plg.has_no_infs(df)
Traceback (most recent call last):
...
pelage.checks.PolarsAssertError: Details1, 2)
shape: (
┌─────┬─────┐
│ a ┆ b │--- ┆ --- │
│
│ i64 ┆ f64 │
╞═════╪═════╡2 ┆ inf │
│
└─────┴─────┘with the DataFrame passed to the check function:
Error -->
>>> plg.has_no_infs(df, ["a"]) # or plg.has_no_infs(df, "a")
2, 2)
shape: (
┌─────┬─────┐
│ a ┆ b │--- ┆ --- │
│
│ i64 ┆ f64 │
╞═════╪═════╡1 ┆ 1.0 │
│ 2 ┆ inf │
│ └─────┴─────┘