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 a slice, standard Python slicing is used (zero-copy for NumPy arrays and AssetPanel).

axisint, default=0

The axis along which X will be sub-sampled. axis=0 will select rows while axis=1 will select columns.

Returns:
subset

Subset of X on axis 0.