safe_indexing(X, indices, *, axis=0)¶
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.
- Xarray-like, sparse-matrix, list, pandas.DataFrame, pandas.Series
Data from which to sample rows, items or columns.
listare only supported when
- indicesbool, int, str, slice, array-like
axis=0, boolean and integer array-like, integer slice, and scalar integer are supported.
to select a single column,
indicescan be of
inttype for all
stronly for dataframe. The selected subset will be 1D, unless
Xis a sparse matrix in which case it will be 2D.
to select multiples columns,
indicescan be one of the following:
slice. The type used in these containers can be one of the following:
int, ‘bool’ and
stris only supported when
Xis a dataframe. The selected subset will be 2D.
- axisint, default=0
The axis along which
Xwill be subsampled.
axis=0will select rows while
axis=1will select columns.
Subset of X on axis 0 or 1.
CSR, CSC, and LIL sparse matrices are supported. COO sparse matrices are not supported.