Statistics
Learn about the statistics module in Python.
We'll cover the following
Introduction to the statistics module
Python also provides you with a statistics module. Here are some of the functions provided by the import statistics
command:
-
mean(data)
: This is the mathematical “average” of the data, computed by adding the values and dividing their sum by the number of values. -
median(data)
: This is the “middle” number of the data, meaning half the values are less than or equal to it and half are greater than or equal to it. If there are an even number of values, the result is the mean of the two middle values. -
mode(data)
: This is the number that occurs most often in the data (or if a tie, the first such number).
Here’s an example of this:
Get hands-on with 1400+ tech skills courses.