# has_columns { #pelage.has_columns }

```python
has_columns(data, names)
```

Check if a DataFrame has the specified

## Parameters {.doc-section .doc-section-parameters}

<code><span class="parameter-name">data</span><span class="parameter-annotation-sep">:</span> <span class="parameter-annotation">[PolarsLazyOrDataFrame](`pelage.types.PolarsLazyOrDataFrame`)</span></code>

:   The DataFrame to check for column presence.

<code><span class="parameter-name">names</span><span class="parameter-annotation-sep">:</span> <span class="parameter-annotation">[Union](`typing.Union`)\[[str](`str`), [List](`typing.List`)\[[str](`str`)\]\]</span></code>

:   The names of the columns to check.

## Returns {.doc-section .doc-section-returns}

| Name   | Type                                                          | Description                                                      |
|--------|---------------------------------------------------------------|------------------------------------------------------------------|
|        | [PolarsLazyOrDataFrame](`pelage.types.PolarsLazyOrDataFrame`) | The original polars DataFrame or LazyFrame when the check passes |

## Examples {.doc-section .doc-section-examples}

```python
>>> import polars as pl
>>> import pelage as plg
>>> df = pl.DataFrame({"a": [1, 2, 3], "b": ["a", "b", "c"]})
>>> df.pipe(plg.has_columns, "b")
shape: (3, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ i64 ┆ str │
╞═════╪═════╡
│ 1   ┆ a   │
│ 2   ┆ b   │
│ 3   ┆ c   │
└─────┴─────┘
```

```python
>>> df.pipe(plg.has_columns, "c")
Traceback (most recent call last):
    ...
pelage.types.PolarsAssertError: Details
Error with the DataFrame passed to the check function:
--> Missing columns if the dataframe: {'c'}
```

```python
>>> df.pipe(plg.has_columns, ["a", "b"])
shape: (3, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ i64 ┆ str │
╞═════╪═════╡
│ 1   ┆ a   │
│ 2   ┆ b   │
│ 3   ┆ c   │
└─────┴─────┘
```
