def isin(self, values):
    "\n        Check whether `values` are contained in Categorical.\n\n        Return a boolean NumPy Array showing whether each element in\n        the Categorical matches an element in the passed sequence of\n        `values` exactly.\n\n        Parameters\n        ----------\n        values : set or list-like\n            The sequence of values to test. Passing in a single string will\n            raise a ``TypeError``. Instead, turn a single string into a\n            list of one element.\n\n        Returns\n        -------\n        isin : numpy.ndarray (bool dtype)\n\n        Raises\n        ------\n        TypeError\n          * If `values` is not a set or list-like\n\n        See Also\n        --------\n        pandas.Series.isin : equivalent method on Series\n\n        Examples\n        --------\n\n        >>> s = pd.Categorical(['lama', 'cow', 'lama', 'beetle', 'lama',\n        ...                'hippo'])\n        >>> s.isin(['cow', 'lama'])\n        array([ True,  True,  True, False,  True, False])\n\n        Passing a single string as ``s.isin('lama')`` will raise an error. Use\n        a list of one element instead:\n\n        >>> s.isin(['lama'])\n        array([ True, False,  True, False,  True, False])\n        "
    from pandas.core.series import _sanitize_array
    if (not is_list_like(values)):
        raise TypeError('only list-like objects are allowed to be passed to isin(), you passed a [{values_type}]'.format(values_type=type(values).__name__))
    values = _sanitize_array(values, None, None)
    null_mask = np.asarray(isna(values))
    code_values = self.categories.get_indexer(values)
    code_values = code_values[(null_mask | (code_values >= 0))]
    return algorithms.isin(self.codes, code_values)
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])
def isin(self, values):
    "\n        Check whether `values` are contained in Categorical.\n\n        Return a boolean NumPy Array showing whether each element in\n        the Categorical matches an element in the passed sequence of\n        `values` exactly.\n\n        Parameters\n        ----------\n        values : set or list-like\n            The sequence of values to test. Passing in a single string will\n            raise a ``TypeError``. Instead, turn a single string into a\n            list of one element.\n\n        Returns\n        -------\n        isin : numpy.ndarray (bool dtype)\n\n        Raises\n        ------\n        TypeError\n          * If `values` is not a set or list-like\n\n        See Also\n        --------\n        pandas.Series.isin : equivalent method on Series\n\n        Examples\n        --------\n\n        >>> s = pd.Categorical(['lama', 'cow', 'lama', 'beetle', 'lama',\n        ...                'hippo'])\n        >>> s.isin(['cow', 'lama'])\n        array([ True,  True,  True, False,  True, False])\n\n        Passing a single string as ``s.isin('lama')`` will raise an error. Use\n        a list of one element instead:\n\n        >>> s.isin(['lama'])\n        array([ True, False,  True, False,  True, False])\n        "
    from pandas.core.series import _sanitize_array
    if (not is_list_like(values)):
        raise TypeError('only list-like objects are allowed to be passed to isin(), you passed a [{values_type}]'.format(values_type=type(values).__name__))
    values = _sanitize_array(values, None, None)
    null_mask = np.asarray(isna(values))
    code_values = self.categories.get_indexer(values)
    code_values = code_values[(null_mask | (code_values >= 0))]
    return algorithms.isin(self.codes, code_values)