@@ -434,10 +434,11 @@ def check_array_indexer(array: AnyArrayLike, indexer: Any) -> Any:
434
434
----------
435
435
array : array-like
436
436
The array that is being indexed (only used for the length).
437
- indexer : array-like or list-like
438
- The array-like that's used to index. List-like input that is not yet
439
- a numpy array or an ExtensionArray is converted to one. Other input
440
- types are passed through as is.
437
+ indexer : array-like, list-like, int, slice, or other indexer
438
+ The indexer used for indexing. Array-like and list-like inputs that
439
+ are not yet a numpy array or an ExtensionArray are converted to one.
440
+ Non-array indexers (int, slice, Ellipsis, tuples, etc.) are passed
441
+ through as is.
441
442
442
443
Returns
443
444
-------
@@ -486,6 +487,13 @@ def check_array_indexer(array: AnyArrayLike, indexer: Any) -> Any:
486
487
>>> pd.api.indexers.check_array_indexer(arr, mask)
487
488
array([ True, False])
488
489
490
+ Integer and slice indexers are passed through as is:
491
+
492
+ >>> pd.api.indexers.check_array_indexer(arr, 1)
493
+ 1
494
+ >>> pd.api.indexers.check_array_indexer(arr, slice(0, 1, 1))
495
+ slice(0, 1, 1)
496
+
489
497
Similarly for integer indexers, an integer ndarray is returned when it is
490
498
a valid indexer, otherwise an error is (for integer indexers, a matching
491
499
length is not required):
0 commit comments