Python Statistics Module
The statistics
module provides functions for mathematical statistics, including measures of central tendency, measures of variability, and probability distributions. It's a useful module for data analysis and scientific computing.
Commonly Used Functions
mean(data)
: Returns the arithmetic mean of the data.median(data)
: Returns the median (middle value) of the data.mode(data)
: Returns the most common value in the data.stdev(data)
: Returns the standard deviation of the data.variance(data)
: Returns the variance of the data.
Example Usage
Python
import statistics
data = [1, 2, 2, 3, 4, 5, 5, 5, 6, 7]
print(statistics.mean(data)) # Arithmetic mean
print(statistics.median(data)) # Median
print(statistics.mode(data)) # Mode
print(statistics.stdev(data)) # Standard deviation
Import Links
Here are some useful import links for further reading: