# accepted_range { #pelage.checks.accepted_range }

`checks.accepted_range(data, items)`

Check that all the values from specifed columns in the dict `items` are within
    the indicated range.

## 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, PolarsColumnBounds\]</span></code>

:   Any type of inputs that match the following signature:
    `column_name: (boundaries)` where boundaries is compatible with the Polars
    method `is_between()` syntax.

    For example:
    ```
    {
    "col_a": (low, high),
    "col_b", (low_b, high_b, "right"),
    "col_c", (low_c, high_c, "none"),
    }
    ```

## Returns

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

## Examples

```python
>>> import polars as pl
>>> import pelage as plg
>>> df = pl.DataFrame({"a": [1, 2, 3]})
>>> df.pipe(plg.accepted_range, {"a": (0, 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:
--> Some values are beyond the acceptable ranges defined
>>> df.pipe(plg.accepted_range, {"a": (1, 3)})
shape: (3, 1)
┌─────┐
│ a   │
│ --- │
│ i64 │
╞═════╡
│ 1   │
│ 2   │
│ 3   │
└─────┘
>>> df = pl.DataFrame({"a": ["b", "c"]})
>>> df.pipe(plg.accepted_range, {"a": (pl.lit("a"), pl.lit("d"), "right")})
shape: (2, 1)
┌─────┐
│ a   │
│ --- │
│ str │
╞═════╡
│ b   │
│ c   │
└─────┘
>>> df.pipe(plg.accepted_range, {"a": (pl.lit("a"), pl.lit("d"), "left")})
shape: (2, 1)
┌─────┐
│ a   │
│ --- │
│ str │
╞═════╡
│ b   │
│ c   │
└─────┘
```