def take_nd(self, indexer, allow_fill=None, fill_value=None):
    '\n        Take elements from the Categorical.\n\n        Parameters\n        ----------\n        indexer : sequence of integers\n        allow_fill : bool, default None.\n            How to handle negative values in `indexer`.\n\n            * False: negative values in `indices` indicate positional indices\n              from the right. This is similar to\n              :func:`numpy.take`.\n\n            * True: negative values in `indices` indicate missing values\n              (the default). These values are set to `fill_value`. Any other\n              other negative values raise a ``ValueError``.\n\n            .. versionchanged:: 0.23.0\n\n               Deprecated the default value of `allow_fill`. The deprecated\n               default is ``True``. In the future, this will change to\n               ``False``.\n\n        Returns\n        -------\n        Categorical\n            This Categorical will have the same categories and ordered as\n            `self`.\n        '
    indexer = np.asarray(indexer, dtype=np.intp)
    if (allow_fill is None):
        if (indexer < 0).any():
            warn(_take_msg, FutureWarning, stacklevel=2)
            allow_fill = True
    if isna(fill_value):
        fill_value = (- 1)
    codes = take(self._codes, indexer, allow_fill=allow_fill, fill_value=fill_value)
    result = self._constructor(codes, dtype=self.dtype, fastpath=True)
    return result
Take elements from the Categorical.

Parameters
----------
indexer : sequence of integers
allow_fill : bool, default None.
    How to handle negative values in `indexer`.

    * False: negative values in `indices` indicate positional indices
      from the right. This is similar to
      :func:`numpy.take`.

    * True: negative values in `indices` indicate missing values
      (the default). These values are set to `fill_value`. Any other
      other negative values raise a ``ValueError``.

    .. versionchanged:: 0.23.0

       Deprecated the default value of `allow_fill`. The deprecated
       default is ``True``. In the future, this will change to
       ``False``.

Returns
-------
Categorical
    This Categorical will have the same categories and ordered as
    `self`.
def take_nd(self, indexer, allow_fill=None, fill_value=None):
    '\n        Take elements from the Categorical.\n\n        Parameters\n        ----------\n        indexer : sequence of integers\n        allow_fill : bool, default None.\n            How to handle negative values in `indexer`.\n\n            * False: negative values in `indices` indicate positional indices\n              from the right. This is similar to\n              :func:`numpy.take`.\n\n            * True: negative values in `indices` indicate missing values\n              (the default). These values are set to `fill_value`. Any other\n              other negative values raise a ``ValueError``.\n\n            .. versionchanged:: 0.23.0\n\n               Deprecated the default value of `allow_fill`. The deprecated\n               default is ``True``. In the future, this will change to\n               ``False``.\n\n        Returns\n        -------\n        Categorical\n            This Categorical will have the same categories and ordered as\n            `self`.\n        '
    indexer = np.asarray(indexer, dtype=np.intp)
    if (allow_fill is None):
        if (indexer < 0).any():
            warn(_take_msg, FutureWarning, stacklevel=2)
            allow_fill = True
    if isna(fill_value):
        fill_value = (- 1)
    codes = take(self._codes, indexer, allow_fill=allow_fill, fill_value=fill_value)
    result = self._constructor(codes, dtype=self.dtype, fastpath=True)
    return result