mean() function is from Standard
statistics Library of Python Programming Language. The basic purpose of Python mean function is to calculate the simple arithmetic mean of given data. The given data will always be in the form of a sequence or iterator such as list, tuple, etc.
The arithmetic mean is commonly known as average, or we can say the average of a given set of numbers is called mean of given number.
According to Wikipedia, simply the mean or average when the context is clear, is the sum of a collection of numbers divided by the number of numbers in the collection.
For further detail of arithmetic mean, you can read this Wikipedia article.
Following is the statistical formula of the arithmetic mean.
The mean is basically the central point of the data.
Syntax of Python
mean()function in Python is as follows:
For reference, you may check Python Mean function syntax here.
Parameters of Python
– This parameter can be any sequence or iterator (lists, tuples)
Note: If data is empty,
mean()function raise a
Return Value of
mean() in Python
mean()is a floating point number after calculating the average or
arithmetic mean of given data in the iterator (lists, tuples, etc…)
mean() Function Examples
# import statistics library
mean()Function in Python