Statistical Functions in Python – Set 1:

We can manipulate some statistical data and also calculate the results of various statistical operations by using the file statistics. It is very useful in the domain of mathematics.

Important average and measure of central location functions:

  1. mean(): It is a function that returns the mean or average of the data passed in the argument. In case the argument is kept empty, StatisticsError will be raised.
  2. mode(): It is a function that returns the number with the maximum number of occurrences. In case the argument passed is empty, StatisticsError will be raised.

  3. median(): It is a function used for the calculation of median, i.e., middle element of data. In case the argument passed is empty StatisticsError will be raised.
  4. median_low(): It is a function that returns the median of data in case of odd number of elements. But in case there are even number of elements, it will return the lower of two middle elements. In case the argument passed is empty, StatisticsError will be raised.
  5. median_high(): When this function is called, it returns the median of data in case of odd number of elements. But when we have even number of elements, it returns the higher of the two middle elements. Similar to the above cases if passed argument is empty, StatisticsError is raised.

  6. median_grouped(): When we call this function, it computes the group median or 50th percentile of data. If argument passed is empty, a StatisticsError is raised.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *