Skip to content

Statistics

Jean Dubois edited this page Jun 1, 2023 · 4 revisions

statistics module

The statistics module can be imported with the statement import statistics.

The statistics module is used to do statistics. To do math, use the math module.

Functions

  • statistics.mean(list): calculate the mean of a list of numbers.
  • statistics.geometric_mean(list): calculate the geometric mean of a list of positive numbers.
  • statistics.harmonic_mean(list): calculate the harmonic mean of a list of positive numbers.
  • statistics.median(list): calculate the median of a list of numbers.
  • statistics.quantiles(list, n=4, method='exclusive'): cut a list of numbers in n parts and returns a list of the values where the list was cut, using exclusive or inclusive method. n and method are optional.
  • statistics.scope(list): calculate the scope of a list of numbers: max(list) - min(list).
  • statistics.mode(list): calculate the mode of a list of numbers, i.e. the most common value.
  • statistics.multimode(value): calculate the modes of a list or a str, i.e. the most common values. It returns a list.
Clone this wiki locally