<a id="skfolio-utils-tools-safe-indexing"></a>

# skfolio.utils.tools.safe_indexing

<a id="skfolio.utils.tools.safe_indexing"></a>

### skfolio.utils.tools.safe_indexing(X, indices, axis=0)

Return rows, items or columns of X using indices.

* **Parameters:**
  **X** *array-like*
  : Data from which to sample rows.

  **indices** *array-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`](https://skfolio.org/generated/skfolio.containers.AssetPanel.html.md#skfolio.containers.AssetPanel)).

  **axis** *int, 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.

