---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://catboost.ai/docs/en/concepts/python-reference_apply_catboost_model.md
  - href: en/concepts/python-reference_apply_catboost_model.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

# Python

## Purpose
Apply the model in Python format. The method is available within the output Python file with the model description.

{% note alert %}

- <!-- source: en/_includes/work_src/reusage-common-phrases/apply_catboost_model__performance.md -->
  The [`apply_catboost_model`](https://catboost.ai/docs/en/concepts/python-reference_apply_catboost_model.md) method is inferior in performance compared to the native CatBoost application methods, especially on large models and datasets.
  <!-- endsource: en/_includes/work_src/reusage-common-phrases/apply_catboost_model__performance.md -->

{% endnote %}


## Dependencies

<!-- source: en/_includes/work_src/reusage-common-phrases/city-hash.md -->
[CityHash v.1](https://github.com/Amper/cityhash/tree/4f02fe0ba78d4a6d1735950a9c25809b11786a56) library. The correct version is also available in the [CatBoost repository](https://github.com/catboost/catboost/tree/master/library/python/cityhash).
<!-- endsource: en/_includes/work_src/reusage-common-phrases/city-hash.md -->


## Method call format

<!-- source: en/_includes/work_src/reusage-common-phrases/for-datasets-that-contain-only-numeric-features.md -->
For datasets that contain only numerical features:
<!-- endsource: en/_includes/work_src/reusage-common-phrases/for-datasets-that-contain-only-numeric-features.md -->


```python
apply_catboost_model(float_features)
```

<!-- source: en/_includes/work_src/reusage-common-phrases/for-datasets-that-contain-both-numerical-and-categorical-features.md -->
For datasets that contain both numerical and categorical features:
<!-- endsource: en/_includes/work_src/reusage-common-phrases/for-datasets-that-contain-both-numerical-and-categorical-features.md -->


```python
apply_catboost_model(float_features,
                     cat_features)
```

## Parameters

### float_features


<!-- source: en/_includes/work_src/reusage-common-phrases/float-features-desc.md -->
The list of numerical features.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/float-features-desc.md -->

Possible types:
- list of int
- list of float


### cat_features


<!-- source: en/_includes/work_src/reusage-common-phrases/categorical-features-list.md -->
The list of categorical features.
<!-- endsource: en/_includes/work_src/reusage-common-phrases/categorical-features-list.md -->

Possible types:
- list of int
- list of float
- list of strings





{% note info %}

<!-- source: en/_includes/work_src/reusage-common-phrases/numerical-and-categorical-features-start.md -->
Numerical and categorical features must be passed separately in the same order they appear in the train dataset.

For example, let's assume that the train dataset contains the following features:

- Numerical features: `f1`, `f3`
- Categorical features: `f2`, `f4`

In this case, the following code must be used to apply the model:
<!-- endsource: en/_includes/work_src/reusage-common-phrases/numerical-and-categorical-features-start.md -->


```python
apply_catboost_model(float_features=[f1,f3],
                     cat_features=[f2,f4])
```

{% endnote %}


## Related information

[`--model-format` key of the command-line train mode](https://catboost.ai/docs/en/references/training-parameters/index.md#cli-reference_train-model)

### Type of return value

numpy.ndarray (identical to the `[CatBoost()](python-reference_catboost.md).[predict](python-reference_catboost_predict.md)(prediction_type='RawFormulaVal')` method output)[Train a model](https://catboost.ai/docs/en/references/training-parameters/index.md)
