The Python statistics module provides a variety of statistical functions for data analysis. Here are some of the functions provided by the module:
- mean(): This function returns the arithmetic mean of a list of numbers.
- median(): This function returns the median value of a list of numbers.
- mode(): This function returns the mode value of a list of numbers.
- stdev(): This function returns the standard deviation of a list of numbers.
- variance(): This function returns the variance of a list of numbers.
- harmonic_mean(): This function returns the harmonic mean of a list of numbers.
- median_low(): This function returns the low median value of a list of numbers.
- median_high(): This function returns the high median value of a list of numbers.
- quantiles(): This function returns a list of quantiles of a list of numbers.
- pstdev(): This function returns the population standard deviation of a list of numbers.
- pvariance(): This function returns the population variance of a list of numbers.
Here is an example of how to use the mean() function:
import statistics numbers = [1, 2, 3, 4, 5] mean = statistics.mean(numbers) print(mean)
Output:
3
Similarly, you can use other functions of the statistics module for data analysis.