MCPcopy
hub / github.com/pandas-dev/pandas / _getitem_iterable

Method _getitem_iterable

pandas/core/indexing.py:1352–1381  ·  view source on GitHub ↗

Index current object with an iterable collection of keys. Parameters ---------- key : iterable Targeted labels. axis : int Dimension on which the indexing is being made. Raises ------ KeyError If n

(self, key, axis: AxisInt)

Source from the content-addressed store, hash-verified

1350 # -------------------------------------------------------------------
1351
1352 def _getitem_iterable(self, key, axis: AxisInt):
1353 """
1354 Index current object with an iterable collection of keys.
1355
1356 Parameters
1357 ----------
1358 key : iterable
1359 Targeted labels.
1360 axis : int
1361 Dimension on which the indexing is being made.
1362
1363 Raises
1364 ------
1365 KeyError
1366 If no key was found. Will change in the future to raise if not all
1367 keys were found.
1368
1369 Returns
1370 -------
1371 scalar, DataFrame, or Series: indexed value(s).
1372 """
1373 # we assume that not com.is_bool_indexer(key), as that is
1374 # handled before we get here.
1375 self._validate_key(key, axis)
1376
1377 # A collection of keys
1378 keyarr, indexer = self._get_listlike_indexer(key, axis)
1379 return self.obj._reindex_with_indexers(
1380 {axis: [keyarr, indexer]}, allow_dups=True
1381 )
1382
1383 def _getitem_tuple(self, tup: tuple):
1384 with suppress(IndexingError):

Callers 1

_getitem_axisMethod · 0.95

Calls 3

_validate_keyMethod · 0.95
_get_listlike_indexerMethod · 0.95

Tested by

no test coverage detected