# dask.dataframe.Index.isin

#### Index.isin(values)

Whether each element in the DataFrame is contained in values.

This docstring was copied from pandas.DataFrame.isin.

Some inconsistencies with the Dask version may exist.

Returns a DataFrame of the same shape with boolean values: True
where the element is in the corresponding structure of
`values`, False otherwise. `values` can be a list, dict,
Series, or DataFrame; alignment rules depend on its type.

* **Parameters:**
  **values**
  : The result will only be true at a location if all the
    labels match. If values is a Series, that’s the index. If
    values is a dict, the keys must be the column names,
    which must match. If values is a DataFrame,
    then both the index and column labels must match.
* **Returns:**
  DataFrame
  : DataFrame of booleans showing whether each element in the DataFrame
    is contained in values.

#### SEE ALSO
[`DataFrame.eq`](dask.dataframe.DataFrame.eq.html.md#dask.dataframe.DataFrame.eq)
: Equality test for DataFrame.

[`Series.isin`](dask.dataframe.Series.isin.html.md#dask.dataframe.Series.isin)
: Equivalent method on Series.

[`Series.str.contains`](dask.dataframe.Series.str.contains.html.md#dask.dataframe.Series.str.contains)
: Test if pattern or regex is contained within a string of a Series or Index.

### Notes

`__iter__` is used (and not `__contains__`) to iterate over values
when checking if it contains the elements in DataFrame.

### Examples

```pycon
>>> df = pd.DataFrame(
...     {"num_legs": [2, 4], "num_wings": [2, 0]}, index=["falcon", "dog"]
... )
>>> df
        num_legs  num_wings
falcon         2          2
dog            4          0
```

When `values` is a list check whether every value in the DataFrame
is present in the list (which animals have 0 or 2 legs or wings)

```pycon
>>> df.isin([0, 2])
        num_legs  num_wings
falcon      True       True
dog        False       True
```

To check if `values` is *not* in the DataFrame, use the `~` operator:

```pycon
>>> ~df.isin([0, 2])
        num_legs  num_wings
falcon     False      False
dog         True      False
```

When `values` is a dict, we can pass values to check for each
column separately:

```pycon
>>> df.isin({"num_wings": [0, 3]})
        num_legs  num_wings
falcon     False      False
dog        False       True
```

When `values` is a Series or DataFrame the index and column must
match. Note that ‘falcon’ does not match based on the number of legs
in other.

```pycon
>>> other = pd.DataFrame(
...     {"num_legs": [8, 3], "num_wings": [0, 2]}, index=["spider", "falcon"]
... )
>>> df.isin(other)
        num_legs  num_wings
falcon     False       True
dog        False      False
```

<!-- !! processed by numpydoc !! -->
