Full name
statistics.harmonic_mean
Library
statistics
Syntax
statistics.harmonic_mean(data)
Description
The statistics.harmonic_mean function returns the harmonic mean of the elements in data:
Parameters
- data: Sequence or iterable from whose elements you want to calculate the harmonic mean.
Result
The statistics.harmonic_mean function returns a float.
Examples
We can obtain the harmonic mean of the numbers contained in a list with the following code:
a = [5, 8, 1, 9, 2]
statistics.harmonic_mean(a)
2.582496413199426