Statistics Functions
statistics.covariance()
Measure joint linear variation of paired observations using the sample denominator n-1. Both sequences need equal lengths of at least two.
Formal Syntax & Structure
python syntaxpython
statistics.covariance(x, y, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | sequence of real numbers | Paired observations, same length as the other sequence. |
| y | sequence of real numbers | Paired observations, same length as the other sequence. |
Return Value
float
Floating-point result; finite precision and domain restrictions apply.
Working Example
Example Snippetpython
import statisticsprint(statistics.covariance([1, 2, 3], [2, 4, 6]))