Skip to content

Commit 430a268

Browse files
committed
DOC: docstrings for _multi_take
1 parent f44aaad commit 430a268

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

pandas/core/indexing.py

+28-2
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,20 @@ def _getitem_tuple(self, tup):
902902
return retval
903903

904904
def _multi_take_opportunity(self, tup):
905+
"""
906+
Check whether there is the possibility to use ``_multi_take``.
907+
Currently the limit is that all axes being indexed must be indexed with
908+
list-likes.
909+
910+
Parameters
911+
----------
912+
tup : tuple
913+
Tuple of indexers, one per axis
914+
915+
Returns
916+
-------
917+
boolean: Whether the current indexing can be passed through _multi_take
918+
"""
905919
if not all(is_list_like_indexer(x) for x in tup):
906920
return False
907921

@@ -912,9 +926,21 @@ def _multi_take_opportunity(self, tup):
912926
return True
913927

914928
def _multi_take(self, tup):
915-
""" create the reindex map for our objects, raise the _exception if we
916-
can't create the indexer
917929
"""
930+
Create the indexers for the passed tuple of keys, and execute the take
931+
operation. This allows the take operation to be executed all at once -
932+
rather than once for each dimension - improving efficiency.
933+
934+
Parameters
935+
----------
936+
tup : tuple
937+
Tuple of indexers, one per axis
938+
939+
Returns
940+
-------
941+
values: same type as the object being indexed
942+
"""
943+
# GH 836
918944
o = self.obj
919945
d = {axis: self._get_listlike_indexer(key, axis)
920946
for (key, axis) in zip(tup, o._AXIS_ORDERS)}

0 commit comments

Comments
 (0)