---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://catboost.ai/docs/en/concepts/python-reference_pool_set_pairs.md
  - href: en/concepts/python-reference_pool_set_pairs.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# set_pairs

<!-- source: en/_includes/work_src/reusage-python/set_pairs__desc.md -->
Set the list of pairs for [Pairwise metrics](https://catboost.ai/docs/en/concepts/loss-functions-ranking.md).
<!-- endsource: en/_includes/work_src/reusage-python/set_pairs__desc.md -->


## Method call format {#call-format}

```python
set_pairs(pairs)
```

## Parameters {#parameters}

### pairs

#### Description

<!-- source: en/_includes/work_src/reusage/python__pairs__intro.md -->
The pairs description in the form of a two-dimensional matrix of shape `N` by 2:
<!-- endsource: en/_includes/work_src/reusage/python__pairs__intro.md -->

- `N` is the number of pairs.
- Each pair is represented as a row in the matrix:
    - The first element in the row (`pair[0]`) contains the zero-based index of the winner object.
    - The second element in the row (`pair[1]`) contains the zero-based index of the loser object.

This information is used for optimization and calculation of [Pairwise metrics](https://catboost.ai/docs/en/concepts/loss-functions-ranking.md).

**Possible types**

- list
- numpy.ndarray
- pandas.DataFrame
- [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html)

**Default value**

Required parameter
