skfolio.utils.tools.safe_indexing#
- skfolio.utils.tools.safe_indexing(X, indices, axis=0)[source]#
Return rows, items or columns of X using indices.
- Parameters:
- Xarray-like
Data from which to sample rows.
- indicesarray-like, slice, or None
Indices, slice, or None. When
None, the entire data is returned. When aslice, standard Python slicing is used (zero-copy for NumPy arrays andAssetPanel).- axisint, default=0
The axis along which
Xwill be sub-sampled.axis=0will select rows whileaxis=1will select columns.
- Returns:
- subset
Subset of X on axis 0.