Exploratory data analysis
Analyze a numeric sample with descriptive measures such as mean, variance, skewness, or interquartile range.
SciPy · Module
scipy.stats is SciPy’s broad statistics module, combining probability distributions with summary statistics, correlations, tests, density estimation, masked-array tools, and quasi-Monte Carlo functionality. It supports both continuous and discrete univariate distributions.
Importing scipy.stats exposes probability distributions and statistical routines for descriptive statistics, correlations, hypothesis tests, masked-array statistics, kernel density estimation, and quasi-Monte Carlo work. Its distributions include continuous and discrete families, while many functions operate along array axes and offer options for missing values or bias handling.
import scipy.statsfrom scipy import stats
sample = [1, 2, 2, 3, 4]
result = stats.describe(sample)
print(result.mean, result.variance, result.minmax)This computes descriptive statistics for a sample and prints selected fields from the returned result.
Analyze a numeric sample with descriptive measures such as mean, variance, skewness, or interquartile range.
Evaluate probability models and generate or transform values using continuous or discrete distributions.
Run statistical tests and correlation calculations on experimental or observational data.
Use kernel density estimation or quasi-Monte Carlo methods for numerical statistical workflows.
scipy.stats is a module containing probability distributions plus statistical functions for summaries, frequencies, correlations, tests, masked statistics, kernel density estimation, and quasi-Monte Carlo. It includes both continuous and discrete distribution families.
Follow-up: How are univariate distributions represented? Each univariate distribution is an instance of a subclass of rv_continuous, or rv_discrete for discrete distributions.
Use scipy.stats.describe for several descriptive statistics of an array. The module also exposes focused routines such as gmean, hmean, skew, kstat, and iqr.
Follow-up: Which routine computes a geometric mean? scipy.stats.gmean computes it along a specified axis and supports dtype and, in the current documentation, weighting and NaN-policy options.
The module includes counterparts in scipy.stats.mstats for masked arrays. The documentation also identifies areas outside SciPy's scope, so choosing a specialized package can be appropriate for some statistical problems.
Follow-up: Why might ordinary scipy.stats functions be unsuitable for masked data? They are not the masked-statistics interface; use the corresponding mstats function when masked-array semantics are required.
scipy.stats.describescipy.stats.gmeanscipy.stats.hmeanscipy.stats.skewscipy.stats.kstatscipy.stats.iqrscipy.stats.mstats