Categories

# Descriptive Statistics Functions in Python

Minimum

Within Python, the minimum represents the smallest value in a collection of value as depicted by: Function:min(). This function takes in multiple parameters or any iterable variable and returns the minimum value among those parameters or from that iterable component (Pascual, 2018). An example of this would be:

a = min (3,4)

print(a)

Here, print(a) would be 3 since that is the minimum.

Maximum

Within Python, the maximum represents the largest value in a collection of value as depicted by: Function:max(). This function takes in multiple parameters or any iterable variable and returns the maximum value among those parameters or from that iterable component (Pascual, 2018). An example of this would be:

a = max (3,4)

print(a)

Here, print(a) would be 4 since that is the maximum.

Range

The range represents the range of values from the minimum to the maximum as depicted by: Function:range(start, stop, step). This function takes in three parameters: start, stop, and step. It produces a range containing numbers from start to stop with step as an incrementing factor (Pascual, 2018). Start and stop are optional with stop being mandatory, and the default for start in 0 and step is 1 (Pascual, 2018). An example of this would be:

a = range (3,7)

for q in a:

print(q)

Here, print  3 4 5 6

Count

Count represents the number of values in a collection as depicted by: Function:count(). This function can be used with list, tuples, sets, and strings, and it counts the occurrence of the specific variable being asked for (Pascual, 2018). An example of this would be:

l = [3,4,5,6,7, 3]

a = l.count(3)

print(a)

Here, print(a) will be 2, as 3 is counted 2 times in the list.

Sum

Sum represents the total of the values in a collection as depicted by: Function:sum(iterable, start). This function takes in two parameters. First is an iterable component where all values are summed (Pascual, 2018). Second, is start which gets added to the final value if provided (Pascual, 2018). This function returns the sum of all values in an iterable component. An example of this would be:

l = [3,4,5,6,7, 3]

a = sum(1)

print(a)

Here, print(a) will be 28.

## References

Pascual, C. (2018). Basic statistics in python: Descriptive statistics. DataQuest. https://www.dataquest.io/blog/basic-statistics-with-python-descriptive-statistics/

## By Hanna Robinson

Hanna has won numerous writing awards. She specializes in academic writing, copywriting, business plans and resumes. After graduating from the Comosun College's journalism program, she went on to work at community newspapers throughout Atlantic Canada, before embarking on her freelancing journey.