---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.3
alternate:
  - https://catboost.ai/docs/en/concepts/python-reference_pool_slice.md
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# slice

<!-- source: en/_includes/work_src/reusage-python/python__pool__slice__desc.md -->
Form a slice of the input dataset from the given list of object indices.
<!-- endsource: en/_includes/work_src/reusage-python/python__pool__slice__desc.md -->


## Method call format {#call-format}

```python
slice(rindex)
```

## Parameters {#parameters}

### rindex

#### Description

The indices of objects to form the slice of the dataset from.

**Possible types**

list
numpy.ndarray

**Default value**

Required parameter

## Type of return value {#output-format}

catboost.Pool

## Example {#usage-examples}

<!-- source: en/_includes/work_src/reusage-code-examples/slice__code-example.md -->
```python
from catboost import Pool

data = [[1, 3],
        [0, 4],
        [1, 7],
        [6, 4],
        [5, 3]]

dataset = Pool(data)
print(dataset.num_row())

dataset_part = dataset.slice([0, 1, 2])
print(dataset_part.num_row())

```
Get a slice of five objects from the input dataset:
<!-- endsource: en/_includes/work_src/reusage-code-examples/slice__code-example.md -->


<!-- source: en/_includes/work_src/reusage-code-examples/slice__output-example.md -->
Output:
```bash
5
3
```
<!-- endsource: en/_includes/work_src/reusage-code-examples/slice__output-example.md -->
