def isin(self, values):
from pandas.core.internals.construction import sanitize_array<EOL>if not is_list_like(values):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format(values_type=type(values).__name__))<EOL><DEDENT>values = sanitize_array(values, None, None)<EOL>null_mask = np.asarray(isna(values))<EOL>code_values = self.categories.get_indexer(values)<EOL>code_values = code_values[null_mask | (code_values >= <NUM_LIT:0>)]<EOL>return algorithms.isin(self.codes, code_values)<EOL>
Check whether `values` are contained in Categorical.

Return a boolean NumPy Array showing whether each element in
the Categorical matches an element in the passed sequence of
`values` exactly.

Parameters
----------
values : set or list-like
    The sequence of values to test. Passing in a single string will
    raise a ``TypeError``. Instead, turn a single string into a
    list of one element.

Returns
-------
isin : numpy.ndarray (bool dtype)

Raises
------
TypeError
  * If `values` is not a set or list-like

See Also
--------
pandas.Series.isin : Equivalent method on Series.

Examples
--------

>>> s = pd.Categorical(['lama', 'cow', 'lama', 'beetle', 'lama',
...                'hippo'])
>>> s.isin(['cow', 'lama'])
array([ True,  True,  True, False,  True, False])

Passing a single string as ``s.isin('lama')`` will raise an error. Use
a list of one element instead:

>>> s.isin(['lama'])
array([ True, False,  True, False,  True, False])