On this page
statistics.fmean
Prev: statistics.covariance | Up: statistics | Next: statistics.geometric_mean
Rel: statistics.correlation, statistics.covariance, statistics.geometric_mean, statistics.harmonic_mean
Ref: docs.python.org — statistics.fmean
Tags: #public #python3 #stdlib #statistics
Import
import statistics
from statistics import fmean
Signature & Overview
statistics.fmean(data, weights=None)
Convert data to floats and compute the arithmetic mean.
Usage
import statistics
assert statistics.fmean([1, 2, 3, 4]) == 2.5
assert statistics.fmean([80, 90], weights=[1, 3]) == 87.5
Gotchas
- Faster than
mean()(always converts tofloat) and supportsweights=(Python 3.11+).
REPL Inspect
from statistics import fmean
help(fmean)
Linked from
- tuts/python3/stdlib_module/statistics
- tuts/python3/stdlib_module/statistics/correlation
- tuts/python3/stdlib_module/statistics/covariance
- tuts/python3/stdlib_module/statistics/geometric_mean
- tuts/python3/stdlib_module/statistics/harmonic_mean
- tuts/python3/stdlib_module/statistics/kde
- tuts/python3/stdlib_module/statistics/kde_random
- tuts/python3/stdlib_module/statistics/linear_regression
- tuts/python3/stdlib_module/statistics/mean
- tuts/python3/stdlib_module/statistics/median
- tuts/python3/stdlib_module/statistics/median_grouped
- tuts/python3/stdlib_module/statistics/median_high
- tuts/python3/stdlib_module/statistics/median_low
- tuts/python3/stdlib_module/statistics/mode
- tuts/python3/stdlib_module/statistics/multimode
- tuts/python3/stdlib_module/statistics/NormalDist
- tuts/python3/stdlib_module/statistics/pstdev
- tuts/python3/stdlib_module/statistics/pvariance
- tuts/python3/stdlib_module/statistics/quantiles
- tuts/python3/stdlib_module/statistics/StatisticsError
- tuts/python3/stdlib_module/statistics/stdev
- tuts/python3/stdlib_module/statistics/variance
Related notes
- tuts/python3/stdlib_module/statistics/correlation Linked here; links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/covariance Linked here; links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/geometric_mean Linked here; links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/harmonic_mean Linked here; links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/statistics/kde links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/kde_random links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/linear_regression links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/mean links to this page; shared tags: #statistics, #stdlib
- tuts/python3/stdlib_module/statistics/median links to this page; shared tags: #statistics, #stdlib