not_accepted_values
not_accepted_values(data, items)
Raises error if columns contains values specified in List of forbbiden items
Parameters
data: PolarsLazyOrDataFrame
:
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, 3], "b": ["a", "b", "c"]}
... {
... )>>> df.pipe(plg.not_accepted_values, {"a": [4, 5]})
3, 2)
shape: (
┌─────┬─────┐
│ a ┆ b │--- ┆ --- │
│ str │
│ i64 ┆
╞═════╪═════╡1 ┆ a │
│ 2 ┆ b │
│ 3 ┆ c │
│ └─────┴─────┘
>>> df.pipe(plg.not_accepted_values, {"b": ["a", "b"]})
Traceback (most recent call last):
...
pelage.types.PolarsAssertError: Details2, 1)
shape: (
┌─────┐
│ b │--- │
│ str │
│
╞═════╡
│ a │
│ b │
└─────┘with the DataFrame passed to the check function:
Error --> This DataFrame contains values marked as forbidden