take(self, indices: 'TakeIndexer', allow_fill: 'bool' = False, fill_value: 'Any' = None)
ExtensionArray.take is called by Series.__getitem__
, .loc
, iloc
, when :None:None:`indices`
is a sequence of values. Additionally, it's called by Series.reindex
, or any other method that causes realignment, with a :None:None:`fill_value`
.
Indices to be taken.
How to handle negative values in :None:None:`indices`
.
False: negative values in :None:None:`indices`
indicate positional indices from the right (the default). This is similar to numpy.take
.
True: negative values in :None:None:`indices`
indicate missing values. These values are set to :None:None:`fill_value`
. Any other other negative values raise a ValueError
.
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 :None:None:`fill_value`
: a user-facing "boxed" scalar, and a low-level physical NA value. :None:None:`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.
When the indices are out of bounds for the array.
When :None:None:`indices`
contains negative values other than -1
and allow_fill
is True.
Take elements from an array.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them