# What's the `z()` function in `stats` package of Python?

In section "Using filter() to identify outliers" of Functional Python Programming - Second Edition by Steven F. Lott, page 106, there's the following code snippet:

```
from stats import mean, stdev, z
dist_data = list(map(dist, trip))
?_d = mean(dist_data)
?_d = stdev(dist_data)
outlier = lambda leg: z(dist(leg), ?_d, ?_d) > 3
print("Outliers", list(filter(outlier, trip)))
```

I googled around but found no `stats`

package in Python. Some relevant stuff includes: statistics package since Python 3.4, and stats.zscore function in scipy. But there's no `z()`

function in these packages.

I also searched in the source code repo of this book, and didn't find above snippet.

Where to find and install this `stats`

package?
Thanks.

### 1 Answer

It looks like an older function:

I am guessing you can try with the zscore function you found.

*edit: I am not saying it will work exactly the same... just that the name and implementation changed. I think you need to update your code if you want it to work... (like removing the mean and standard deviation)

Have you tried downloading code from the page at packtpub.com/books/content/support/31830?