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

# skfolio.utils.tools.safe_split

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

### skfolio.utils.tools.safe_split(X, y=None, indices=None, axis=0)

Create subset of dataset.

Slice X, y according to indices for cross-validation.

* **Parameters:**
  **X** *array-like*
  : Data to be indexed.

  **y** *array-like*
  : Data to be indexed.

  **indices** *ndarray of int, optional*
  : Rows or columns to select from X and y.
    The default (`None`) is to select the entire data.

  **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:**
  **X_subset** *array-like*
  : Indexed data.

  **y_subset** *array-like*
  : Indexed targets.

