4.5 Central Tendency

One of the most often-used measures of a collection of data is known as central tendency—a measure that estimates where the “typical value” of a collection will be found. Three common ways to compute central tendency are (1) the mean, (2) the median, and (3) the mode.

4.5.1 Mean

The most common measure of central tendency is the mean (more commonly called the average). The mean is simply the sum of all the values in the data collection divided by the length. As shown in LISTING 4.4, to compute the mean, we add up the values in the collection and divide by the number of items. Specifically, given a list of values, we use the built-in sum function, shown in Table 4.6, to compute a total and the len function to compute ...

Get Python Programming in Context, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.