# StandardScaler

*noun*

say it: **“STAN-derd SKAY-ler”** **/ˈstændərd ˈskeɪlər/**

A scikit-learn tool that rescales each feature to an average of 0 and a standard deviation of 1, using values learned from the training data.

## What is **StandardScaler**?

**StandardScaler** is scikit-learn's tool for standardization: `fit()` learns each column's mean and standard
deviation from the training rows, and `transform()` rescales any rows with them. Fitting it on the training rows only,
inside a pipeline, keeps the test rows from leaking in.

```python
from sklearn.preprocessing import StandardScaler
train = [[10], [20], [30]]    # dollars per visit
scaler = StandardScaler().fit(train)
print(scaler.mean_)                         # [20.]
print(scaler.transform([[40]]).round(2))    # [[2.45]]: rescaled with the training mean
```

## In a sentence

- “Putting the **StandardScaler** inside the pipeline kept the test rows out of its averages.”
- “The **StandardScaler** learned an average spend of $20 from the training rows.”

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/standardscaler
