Hey, readers! In this article, we will be focusing on **Python statistics module**, in detail. So, let us begin!! ðŸ™‚

## Crisp overview: Python statistics module

Python, being a multi-purpose programming language, loads of manipulations and complex calculations can be performed with the data. Especially in the domain of data science and analytics, we deal with a huge amount of raw data that needs to be processed for better modeling.

For the same, the Python statistics module can be used. It enables us to perform all the statistical operations by using in-built functions for the same. With the statistics module, we deal with the numeric data and perform manipulations on the data to draw various statistical observations from the raw data.

In the context of this topic, we will be having a look at the below functions of statistics module–

**mean of the data****median and its variants**–**standard deviation**

## 1. Calculating mean with statistics module

Mean provides us the overall distribution of the data. It represents the estimation of the entire dataset at a glance or in brief. With the statistics module, we can easily calculate the mean of data using the mean() function as shown below.

**Syntax**:

```
statistics.mean(data)
```

## 2. Variants of median in statistics module

Median enables us to have a midpoint of the data represented without having to treat or sort the raw data. Using the statistics.median() function, we can get the median value for the data variable.

Apart from the median value, we can have two different variants of it as mentioned below–

- median_high() function: When the data variables are discrete in nature, we usually require the higher median value from the range of data. With the median_high() function, it makes us easy to fetch the higher values of the median from the parameter of data passed.
- median_low() function: This function enables us to have a lower median value picked from the range of data. It is useful when we look for exact data points instead of interpolation data points.

**Syntax**:

```
statistics.median_high(data)
statistics.median_low(data)
```

## 3. Standard Deviation in statistics module

Apart from mean and median, the Python statistics module also supports functions that enable us to have the value for the standard deviation of a dataset.

The statistics.stdev() function enables us to have the standard deviation calculated for the data points.

**Syntax**:

```
stdev(data)
```

## Example: Functions offered by statistics module

Having understood the above functions, let us now implement the same through the below example–

**Example**:

```
import statistics
info = [10,1,2,3,4,5,6,7,8,100]
res = statistics.mean(info)
print("Mean: ",res)
res = statistics.median(info)
print("Median: ", res)
res = statistics.median_grouped(info)
print("50% value: ",res)
res = statistics.median_high(info)
print("Median High value: ",res)
res = statistics.median_low(info)
print("Median Low value: ", res)
res = statistics.stdev(info)
print("Standard Deviation: ",res)
```

**Output–**

```
Mean: 14.6
Median: 5.5
50% value: 5.5
Median High value: 6
Median Low value: 5
Standard Deviation: 30.133775807960816
```

## Conclusion

By this, we have come to the end of this topic. Feel free to comment below, in case you come across any topic.

For more such posts related to Python programming, Stay tuned with us.

Till then, Happy Learning! ðŸ™‚