liveBook · Manning

Z-score

As explained in Pandas Workout: 200 exercises to make you a stronger data analyst

A z-score is the number of standard deviations by which a value differs from the mean of its data set.

A z-score rescales and centers a data set around a mean of 0, showing whether each value lies above or below that center. section 2.20

Flag unusually distant trips

Apply scipy.stats.zscore to trip distances, then find every distance whose absolute z-score exceeds 3. This turns an outlier question into a direct filtering task. section 2.20

df = df.dropna().copy()

For a complete-data workflow, create a copy after dropping rows with missing values before continuing analysis. section 2.20

How Pandas Workout: 200 exercises to make you a stronger data analyst covers it

How deep it goes
Defines rescaling and centering, then stops at applying scipy.stats.zscore to search for absolute scores above 3.
Examples
Uses trip distances and an absolute z-score threshold of 3 as the concrete analysis.
What it assumes
Assumes a pandas data set and familiarity with asking analytical questions; addresses missing values separately.
What you can do after
Apply scipy.stats.zscore to identify distances whose absolute standardized values exceed 3.
How it connects
Connects z-scores with outliers, means, data sets, pandas, and missing data.

Also explained in

Compare how 8 books explain z-score →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pandas Workout: 200 exercises to make you a stronger data analyst. The section links point to the parts of the book it draws on.