# to_numeric()

*noun*

say it: **“too noo-MAIR-ik”** **/tu nuˈmɛrɪk/**

A pandas function that turns text such as "12.5" into numbers, and can mark each value it can't read as missing instead of stopping.

## What does **to_numeric()** do in pandas?

**to_numeric()** (`pd.to_numeric`) turns a column of text, such as `"59"` and `"12.5"`, into numbers. On its own it
stops at the first value it can't read; with `errors="coerce"`, each such value becomes `NaN` instead, so you can count
and look at them afterward.

```python
import pandas as pd
weights = pd.Series(["59", "12.5", "about 40"])
print(pd.to_numeric(weights, errors="coerce"))
# 0    59.0
# 1    12.5
# 2     NaN
```

## In a sentence

- “The weights were text until **to_numeric()** made them numbers she could average.”
- “**to_numeric()** with errors="coerce" turned the one unreadable weight into NaN.”

Level: Journeyman · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/to-numeric
