Statistics Functions
statistics.median()
Find the middle sorted value, averaging the middle two for an even number of observations. Remove NaNs before sorting.
Formal Syntax & Structure
python syntaxpython
statistics.median(data)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| data | iterable of numbers | Observations used by the statistic. |
Return Value
number
Numeric result; concrete type depends on inputs.
Working Example
Example Snippetpython
import statisticsprint(statistics.median([7, 1, 3, 9]))