sklearn.utils
.safe_indexing¶
Warning
DEPRECATED

sklearn.utils.
safe_indexing
(X, indices, *, axis=0)[source]¶ DEPRECATED: safe_indexing is deprecated in version 0.22 and will be removed in version 0.24.
Return rows, items or columns of X using indices.
Deprecated since version 0.22: This function was deprecated in version 0.22 and will be removed in version 0.24.
 Parameters
 Xarraylike, sparsematrix, list, pandas.DataFrame, pandas.Series
Data from which to sample rows, items or columns.
list
are only supported whenaxis=0
. indicesbool, int, str, slice, arraylike
If
axis=0
, boolean and integer arraylike, integer slice, and scalar integer are supported.If
axis=1
:to select a single column,
indices
can be ofint
type for allX
types andstr
only for dataframe. The selected subset will be 1D, unlessX
is a sparse matrix in which case it will be 2D.to select multiples columns,
indices
can be one of the following:list
,array
,slice
. The type used in these containers can be one of the following:int
, ‘bool’ andstr
. However,str
is only supported whenX
is a dataframe. The selected subset will be 2D.
 axisint, default=0
The axis along which
X
will be subsampled.axis=0
will select rows whileaxis=1
will select columns.
 Returns
 subset
Subset of X on axis 0 or 1.
Notes
CSR, CSC, and LIL sparse matrices are supported. COO sparse matrices are not supported.