# accepted_values { #pelage.checks.accepted_values }

`checks.accepted_values(data, items)`

Raises error if columns contains values not specified in `items`

## Parameters

<code><span class="parameter-name">data</span><span class="parameter-annotation-sep">:</span> <span class="parameter-annotation">PolarsLazyOrDataFrame</span></code>

:   

<code><span class="parameter-name">items</span><span class="parameter-annotation-sep">:</span> <span class="parameter-annotation">Dict\[str, List\]</span></code>

:   A dictionnary where keys are a string compatible with a pl.Expr, to be used with
    pl.col(). The value for each key is a List of all authorized values in the
    dataframe.

## Returns

| Type                  | Description                                                      |
|-----------------------|------------------------------------------------------------------|
| PolarsLazyOrDataFrame | The original polars DataFrame or LazyFrame when the check passes |

## Examples

```python
>>> import polars as pl
>>> import pelage as plg
>>> items = {"a": [1, 2, 3], "b": ["a", "b", "c"]}
>>> df = pl.DataFrame(items)
>>> df.pipe(plg.accepted_values, {"a": [1, 2, 3]})
shape: (3, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ i64 ┆ str │
╞═════╪═════╡
│ 1   ┆ a   │
│ 2   ┆ b   │
│ 3   ┆ c   │
└─────┴─────┘
>>> df.pipe(plg.accepted_values, {"a": [1, 2]})
Traceback (most recent call last):
...
pelage.checks.PolarsAssertError: Details
shape: (1, 1)
┌─────┐
│ a   │
│ --- │
│ i64 │
╞═════╡
│ 3   │
└─────┘
Error with the DataFrame passed to the check function:
--> It contains values that have not been white-Listed in `items`.
Showing problematic columns only.
```