statistics.geometric_mean

Full name
statistics.geometric_mean
Library
statistics
Syntax

statistics.geometric_mean(data)

Description

The statistics.geometric_mean function converts the elements of data into floats and returns their geometric mean:

statistics.geometric_mean
Parameters
  • data: Sequence or iterable from whose elements you want to calculate the geometric mean.
Result

The statistics.geometric_mean function returns a float.

Examples

We can obtain the geometric mean of the numbers contained in a list with the following code:

a = [5, 8, 1, 9, 2]
statistics.geometric_mean(a)
3.7279192731913513
Submitted by admin on Wed, 03/24/2021 - 08:00