statistics.stdev()

statistics.stdev(data, xbar=None) Return the sample standard deviation (the square root of the sample variance). See variance() for arguments and other details. >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 1.0810874155219827

StopAsyncIteration

exception StopAsyncIteration Must be raised by __anext__() method of an asynchronous iterator object to stop the iteration. New in version 3.5.

statistics.StatisticsError

exception statistics.StatisticsError Subclass of ValueError for statistics-related exceptions.

statistics.variance()

statistics.variance(data, xbar=None) Return the sample variance of data, an iterable of at least two real-valued numbers. Variance, or second moment about the mean, is a measure of the variability (spread or dispersion) of data. A large variance indicates that the data is spread out; a small variance indicates it is clustered closely around the mean. If the optional second argument xbar is given, it should be the mean of data. If it is missing or None (the default), the mean is automatically

statistics.mean()

statistics.mean(data) Return the sample arithmetic mean of data, a sequence or iterator of real-valued numbers. The arithmetic mean is the sum of the data divided by the number of data points. It is commonly called “the average”, although it is only one of many different mathematical averages. It is a measure of the central location of the data. If data is empty, StatisticsError will be raised. Some examples of use: >>> mean([1, 2, 3, 4, 4]) 2.8 >>> mean([-1.0, 2.5, 3.25, 5

statistics.median_grouped()

statistics.median_grouped(data, interval=1) Return the median of grouped continuous data, calculated as the 50th percentile, using interpolation. If data is empty, StatisticsError is raised. >>> median_grouped([52, 52, 53, 54]) 52.5 In the following example, the data are rounded, so that each value represents the midpoint of data classes, e.g. 1 is the midpoint of the class 0.5-1.5, 2 is the midpoint of 1.5-2.5, 3 is the midpoint of 2.5-3.5, etc. With the data given, the middle val

statistics.median()

statistics.median(data) Return the median (middle value) of numeric data, using the common “mean of middle two” method. If data is empty, StatisticsError is raised. The median is a robust measure of central location, and is less affected by the presence of outliers in your data. When the number of data points is odd, the middle data point is returned: >>> median([1, 3, 5]) 3 When the number of data points is even, the median is interpolated by taking the average of the two middle v

statistics.mode()

statistics.mode(data) Return the most common data point from discrete or nominal data. The mode (when it exists) is the most typical value, and is a robust measure of central location. If data is empty, or if there is not exactly one most common value, StatisticsError is raised. mode assumes discrete data, and returns a single value. This is the standard treatment of the mode as commonly taught in schools: >>> mode([1, 1, 2, 3, 3, 3, 3, 4]) 3 The mode is unique in that it is the on

statistics.median_low()

statistics.median_low(data) Return the low median of numeric data. If data is empty, StatisticsError is raised. The low median is always a member of the data set. When the number of data points is odd, the middle value is returned. When it is even, the smaller of the two middle values is returned. >>> median_low([1, 3, 5]) 3 >>> median_low([1, 3, 5, 7]) 3 Use the low median when your data are discrete and you prefer the median to be an actual data point rather than interpo

statistics.pvariance()

statistics.pvariance(data, mu=None) Return the population variance of data, a non-empty iterable of real-valued numbers. Variance, or second moment about the mean, is a measure of the variability (spread or dispersion) of data. A large variance indicates that the data is spread out; a small variance indicates it is clustered closely around the mean. If the optional second argument mu is given, it should be the mean of data. If it is missing or None (the default), the mean is automatically ca