Python statistics module

The statistics module in Python is used to perform statistical tasks, with statistical functions, including, mean, median, mode, stdev(), etc.

How to import statistics module in Python

To import the statistical module and use its mathematical functions, write the following at the start of the Python program:

Examples – statistics module functions

Let us see the following examples of the statistics module:

  1. mean( )
  2. median( )
  3. mode( )
  4. stdev( )

mean() function in Python

To calculate the mean, use the mean() function in Python. Let us see an example:

The output is as follows:

median() function in Python

To calculate the median, use the median() function in Python. Let us see an example:

The output is as follows:

mode() function in Python

To calculate the mode, use the mode() function in Python. Let us see an example:

The output is as follows:

stdev() function in Python

To calculate the standard deviation, use the stdev() function in Python. Let us see an example:

The output is as follows:

Python Tutorial (English)

If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.


For Videos, Join Our YouTube Channel: Join Now


Read More:

Python Modules
Python math module
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading