class_docstr: Abstract base class for custom 1-D array types.
  
  pandas will recognize instances of this class as proper arrays
  with a custom type and will not attempt to coerce them to objects. They
  may be stored directly inside a :class:`DataFrame` or :class:`Series`.
  
  .. versionadded:: 0.23.0
  
  Notes
  -----
  The interface includes the following abstract methods that must be
  implemented by subclasses:
  
  * _from_sequence
  * _from_factorized
  * __getitem__
  * __len__
  * dtype
  * nbytes
  * isna
  * take
  * copy
  * _concat_same_type
  
  A default repr displaying the type, (truncated) data, length,
  and dtype is provided. It can be customized or replaced by
  by overriding:
  
  * __repr__ : A default repr for the ExtensionArray.
  * _formatter : Print scalars inside a Series or DataFrame.
  
  Some methods require casting the ExtensionArray to an ndarray of Python
  objects with ``self.astype(object)``, which may be expensive. When
  performance is a concern, we highly recommend overriding the following
  methods:
  
  * fillna
  * dropna
  * unique
  * factorize / _values_for_factorize
  * argsort / _values_for_argsort
  * searchsorted
  
  The remaining methods implemented on this class should be performant,
  as they only compose abstract methods. Still, a more efficient
  implementation may be available, and these methods can be overridden.
  
  One can implement methods to handle array reductions.
  
  * _reduce
  
  One can implement methods to handle parsing from strings that will be used
  in methods such as ``pandas.io.parsers.read_csv``.
  
  * _from_sequence_of_strings
  
  This class does not inherit from 'abc.ABCMeta' for performance reasons.
  Methods and properties required by the interface raise
  ``pandas.errors.AbstractMethodError`` and no ``register`` method is
  provided for registering virtual subclasses.
  
  ExtensionArrays are limited to 1 dimension.
  
  They may be backed by none, one, or many NumPy arrays. For example,
  ``pandas.Categorical`` is an extension array backed by two arrays,
  one for codes and one for categories. An array of IPv6 address may
  be backed by a NumPy structured array with two fields, one for the
  lower 64 bits and one for the upper 64 bits. Or they may be backed
  by some other storage type, like Python lists. Pandas makes no
  assumptions on how the data are stored, just that it can be converted
  to a NumPy array.
  The ExtensionArray interface does not impose any rules on how this data
  is stored. However, currently, the backing data cannot be stored in
  attributes called ``.values`` or ``._values`` to ensure full compatibility
  with pandas internals. But other names as ``.data``, ``._data``,
  ``._items``, ... can be freely used.
class_docstr_tok: ["Abstract","base","class","for","custom","1-D","array","types",".","pandas","will","recognize","instances","of","this","class","as","proper","arrays","with","a","custom","type","and","will","not","attempt","to","coerce","them","to","objects",".","They","may","be","stored","directly","inside","a",":","class",":","`","DataFrame","`","or",":","class",":","`","Series","`",".","..","versionadded",":",":","0.23.0","Notes","--","--","-","The","interface","includes","the","following","abstract","methods","that","must","be","implemented","by","subclasses",":","*","_from_sequence","*","_from_factorized","*","__getitem__","*","__len__","*","dtype","*","nbytes","*","isna","*","take","*","copy","*","_concat_same_type","A","default","repr","displaying","the","type",",","(","truncated",")","data",",","length",",","and","dtype","is","provided",".","It","can","be","customized","or","replaced","by","by","overriding",":","*","__repr__",":","A","default","repr","for","the","ExtensionArray",".","*","_formatter",":","Print","scalars","inside","a","Series","or","DataFrame",".","Some","methods","require","casting","the","ExtensionArray","to","an","ndarray","of","Python","objects","with","``","self.astype","(","object",")","``",",","which","may","be","expensive",".","When","performance","is","a","concern",",","we","highly","recommend","overriding","the","following","methods",":","*","fillna","*","dropna","*","unique","*","factorize","\/","_values_for_factorize","*","argsort","\/","_values_for_argsort","*","searchsorted","The","remaining","methods","implemented","on","this","class","should","be","performant",",","as","they","only","compose","abstract","methods",".","Still",",","a","more","efficient","implementation","may","be","available",",","and","these","methods","can","be","overridden",".","One","can","implement","methods","to","handle","array","reductions",".","*","_reduce","One","can","implement","methods","to","handle","parsing","from","strings","that","will","be","used","in","methods","such","as","``","pandas.io.parsers.read_csv","``",".","*","_from_sequence_of_strings","This","class","does","not","inherit","from","'abc.ABCMeta","'","for","performance","reasons",".","Methods","and","properties","required","by","the","interface","raise","``","pandas.errors.AbstractMethodError","``","and","no","``","register","``","method","is","provided","for","registering","virtual","subclasses",".","ExtensionArrays","are","limited","to","1","dimension",".","They","may","be","backed","by","none",",","one",",","or","many","NumPy","arrays",".","For","example",",","``","pandas.Categorical","``","is","an","extension","array","backed","by","two","arrays",",","one","for","codes","and","one","for","categories",".","An","array","of","IPv6","address","may","be","backed","by","a","NumPy","structured","array","with","two","fields",",","one","for","the","lower","64","bits","and","one","for","the","upper","64","bits",".","Or","they","may","be","backed","by","some","other","storage","type",",","like","Python","lists",".","Pandas","makes","no","assumptions","on","how","the","data","are","stored",",","just","that","it","can","be","converted","to","a","NumPy","array",".","The","ExtensionArray","interface","does","not","impose","any","rules","on","how","this","data","is","stored",".","However",",","currently",",","the","backing","data","can","not","be","stored","in","attributes","called","``",".values","``","or","``","._values","``","to","ensure","full","compatibility","with","pandas","internals",".","But","other","names","as","``",".data","``",",","``","._data","``",",","``","._items","``",",","...","can","be","freely","used","."]
docstr: Take elements from an array.
  
  Parameters
  ----------
  indices : sequence of integers
      Indices to be taken.
  allow_fill : bool, default False
      How to handle negative values in `indices`.
  
      * False: negative values in `indices` indicate positional indices
        from the right (the default). This is similar to
        :func:`numpy.take`.
  
      * True: negative values in `indices` indicate
        missing values. These values are set to `fill_value`. Any other
        other negative values raise a ``ValueError``.
  
  fill_value : any, optional
      Fill value to use for NA-indices when `allow_fill` is True.
      This may be ``None``, in which case the default NA value for
      the type, ``self.dtype.na_value``, is used.
  
      For many ExtensionArrays, there will be two representations of
      `fill_value`: a user-facing "boxed" scalar, and a low-level
      physical NA value. `fill_value` should be the user-facing version,
      and the implementation should handle translating that to the
      physical version for processing the take if necessary.
  
  Returns
  -------
  ExtensionArray
  
  Raises
  ------
  IndexError
      When the indices are out of bounds for the array.
  ValueError
      When `indices` contains negative values other than ``-1``
      and `allow_fill` is True.
  
  Notes
  -----
  ExtensionArray.take is called by ``Series.__getitem__``, ``.loc``,
  ``iloc``, when `indices` is a sequence of values. Additionally,
  it's called by :meth:`Series.reindex`, or any other method
  that causes realignment, with a `fill_value`.
  
  See Also
  --------
  numpy.take
  pandas.api.extensions.take
  
  Examples
  --------
  Here's an example implementation, which relies on casting the
  extension array to object dtype. This uses the helper method
  :func:`pandas.api.extensions.take`.
  
  .. code-block:: python
  
     def take(self, indices, allow_fill=False, fill_value=None):
         from pandas.core.algorithms import take
  
         # If the ExtensionArray is backed by an ndarray, then
         # just pass that here instead of coercing to object.
         data = self.astype(object)
  
         if allow_fill and fill_value is None:
             fill_value = self.dtype.na_value
  
         # fill value should always be translated from the scalar
         # type for the array, to the physical storage type for
         # the data, before passing to take.
  
         result = take(data, indices, fill_value=fill_value,
                       allow_fill=allow_fill)
         return self._from_sequence(result, dtype=self.dtype)
docstr_tok: ["Take","elements","from","an","array",".","Parameters","--","--","--","--","--","indices",":","sequence","of","integers","Indices","to","be","taken",".","allow_fill",":","bool",",","default","False","How","to","handle","negative","values","in","`","indices","`",".","*","False",":","negative","values","in","`","indices","`","indicate","positional","indices","from","the","right","(","the","default",")",".","This","is","similar","to",":","func",":","`","numpy.take","`",".","*","True",":","negative","values","in","`","indices","`","indicate","missing","values",".","These","values","are","set","to","`","fill_value","`",".","Any","other","other","negative","values","raise","a","``","ValueError","``",".","fill_value",":","any",",","optional","Fill","value","to","use","for","NA-indices","when","`","allow_fill","`","is","True",".","This","may","be","``","None","``",",","in","which","case","the","default","NA","value","for","the","type",",","``","self.dtype.na_value","``",",","is","used",".","For","many","ExtensionArrays",",","there","will","be","two","representations","of","`","fill_value","`",":","a","user-facing","``","boxed","''","scalar",",","and","a","low-level","physical","NA","value",".","`","fill_value","`","should","be","the","user-facing","version",",","and","the","implementation","should","handle","translating","that","to","the","physical","version","for","processing","the","take","if","necessary",".","Returns","--","--","--","-","ExtensionArray","Raises","--","--","--","IndexError","When","the","indices","are","out","of","bounds","for","the","array",".","ValueError","When","`","indices","`","contains","negative","values","other","than","``","-1","``","and","`","allow_fill","`","is","True",".","Notes","--","--","-","ExtensionArray.take","is","called","by","``","Series.__getitem__","``",",","``",".loc","``",",","``","iloc","``",",","when","`","indices","`","is","a","sequence","of","values",".","Additionally",",","it","'s","called","by",":","meth",":","`","Series.reindex","`",",","or","any","other","method","that","causes","realignment",",","with","a","`","fill_value","`",".","See","Also","--","--","--","--","numpy.take","pandas.api.extensions.take","Examples","--","--","--","--","Here","'s","an","example","implementation",",","which","relies","on","casting","the","extension","array","to","object","dtype",".","This","uses","the","helper","method",":","func",":","`","pandas.api.extensions.take","`",".","..","code-block",":",":","python","def","take","(","self",",","indices",",","allow_fill=False",",","fill_value=None",")",":","from","pandas.core.algorithms","import","take","#","If","the","ExtensionArray","is","backed","by","an","ndarray",",","then","#","just","pass","that","here","instead","of","coercing","to","object",".","data","=","self.astype","(","object",")","if","allow_fill","and","fill_value","is","None",":","fill_value","=","self.dtype.na_value","#","fill","value","should","always","be","translated","from","the","scalar","#","type","for","the","array",",","to","the","physical","storage","type","for","#","the","data",",","before","passing","to","take",".","result","=","take","(","data",",","indices",",","fill_value=fill_value",",","allow_fill=allow_fill",")","return","self._from_sequence","(","result",",","dtype=self.dtype",")"]
code: def take(self, indices, allow_fill=False, fill_value=None):
      # type: (Sequence[int], bool, Optional[Any]) -> ExtensionArray
      """
      Take elements from an array.
  
      Parameters
      ----------
      indices : sequence of integers
          Indices to be taken.
      allow_fill : bool, default False
          How to handle negative values in `indices`.
  
          * False: negative values in `indices` indicate positional indices
            from the right (the default). This is similar to
            :func:`numpy.take`.
  
          * True: negative values in `indices` indicate
            missing values. These values are set to `fill_value`. Any other
            other negative values raise a ``ValueError``.
  
      fill_value : any, optional
          Fill value to use for NA-indices when `allow_fill` is True.
          This may be ``None``, in which case the default NA value for
          the type, ``self.dtype.na_value``, is used.
  
          For many ExtensionArrays, there will be two representations of
          `fill_value`: a user-facing "boxed" scalar, and a low-level
          physical NA value. `fill_value` should be the user-facing version,
          and the implementation should handle translating that to the
          physical version for processing the take if necessary.
  
      Returns
      -------
      ExtensionArray
  
      Raises
      ------
      IndexError
          When the indices are out of bounds for the array.
      ValueError
          When `indices` contains negative values other than ``-1``
          and `allow_fill` is True.
  
      Notes
      -----
      ExtensionArray.take is called by ``Series.__getitem__``, ``.loc``,
      ``iloc``, when `indices` is a sequence of values. Additionally,
      it's called by :meth:`Series.reindex`, or any other method
      that causes realignment, with a `fill_value`.
  
      See Also
      --------
      numpy.take
      pandas.api.extensions.take
  
      Examples
      --------
      Here's an example implementation, which relies on casting the
      extension array to object dtype. This uses the helper method
      :func:`pandas.api.extensions.take`.
  
      .. code-block:: python
  
         def take(self, indices, allow_fill=False, fill_value=None):
             from pandas.core.algorithms import take
  
             # If the ExtensionArray is backed by an ndarray, then
             # just pass that here instead of coercing to object.
             data = self.astype(object)
  
             if allow_fill and fill_value is None:
                 fill_value = self.dtype.na_value
  
             # fill value should always be translated from the scalar
             # type for the array, to the physical storage type for
             # the data, before passing to take.
  
             result = take(data, indices, fill_value=fill_value,
                           allow_fill=allow_fill)
             return self._from_sequence(result, dtype=self.dtype)
      """
      # Implementer note: The `fill_value` parameter should be a user-facing
      # value, an instance of self.dtype.type. When passed `fill_value=None`,
      # the default of `self.dtype.na_value` should be used.
      # This may differ from the physical storage type your ExtensionArray
      # uses. In this case, your implementation is responsible for casting
      # the user-facing type to the storage type, before using
      # pandas.api.extensions.take
      raise AbstractMethodError(self)
  
imports: import operator
  import numpy
  from pandas.compat import PY3, set_function_name
  from pandas.compat.numpy import function
  from pandas.errors import AbstractMethodError
  from pandas.util._decorators import Appender, Substitution
  from pandas.core.dtypes.common import is_list_like
  from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries
  from pandas.core.dtypes.missing import isna
  from pandas.core import ops
label_desc: Use image node_id 24 for calling the ExtensionArray obj's underlying member method code with example usage: obj.take(indices, allow_fill, fill_value) without return types