Convert an OuterIndexer into an indexer for NumPy. Parameters ---------- indexer : Basic/OuterIndexer An indexer to convert. shape : tuple Shape of the array subject to the indexing. Returns ------- tuple Tuple suitable for use to index a NumPy a
(indexer: BasicIndexer | OuterIndexer, shape: _Shape)
| 1062 | |
| 1063 | |
| 1064 | def _outer_to_numpy_indexer(indexer: BasicIndexer | OuterIndexer, shape: _Shape): |
| 1065 | """Convert an OuterIndexer into an indexer for NumPy. |
| 1066 | |
| 1067 | Parameters |
| 1068 | ---------- |
| 1069 | indexer : Basic/OuterIndexer |
| 1070 | An indexer to convert. |
| 1071 | shape : tuple |
| 1072 | Shape of the array subject to the indexing. |
| 1073 | |
| 1074 | Returns |
| 1075 | ------- |
| 1076 | tuple |
| 1077 | Tuple suitable for use to index a NumPy array. |
| 1078 | """ |
| 1079 | if len([k for k in indexer.tuple if not isinstance(k, slice)]) <= 1: |
| 1080 | # If there is only one vector and all others are slice, |
| 1081 | # it can be safely used in mixed basic/advanced indexing. |
| 1082 | # Boolean index should already be converted to integer array. |
| 1083 | return indexer.tuple |
| 1084 | else: |
| 1085 | return _outer_to_vectorized_indexer(indexer, shape).tuple |
| 1086 | |
| 1087 | |
| 1088 | def _combine_indexers(old_key, shape: _Shape, new_key) -> VectorizedIndexer: |
no test coverage detected
searching dependent graphs…