sklearn.utils
.safe_indexing¶
-
sklearn.utils.
safe_indexing
(X, indices)[source]¶ Return items or rows from X using indices.
Allows simple indexing of lists or arrays.
Parameters: - X : array-like, sparse-matrix, list, pandas.DataFrame, pandas.Series.
Data from which to sample rows or items.
- indices : array-like of int
Indices according to which X will be subsampled.
Returns: - subset
Subset of X on first axis
Notes
CSR, CSC, and LIL sparse matrices are supported. COO sparse matrices are not supported.