Data science: Python statistic module
In the in-build modules, Python has its own statistic module. You don’t need to install it. You can calculate your for example the mean and median.
What is the mean?
In mathematics and statistics, the arithmetic mean, arithmetic average, or just the mean or average is the sum of a collection of numbers divided by the count of numbers in the collection. The collection is often a set of results from an experiment, an observational study, or a survey. The term „arithmetic mean“ is preferred in some contexts in mathematics and statistics because it helps to distinguish it from other types of means, such as geometric and harmonic.
From Wikipedia
What is the median?
The median of a set of numbers is the value separating the higher half from the lower half of a data sample, a population, or a probability distribution. For a data set, it may be thought of as the „middle“ value. The basic feature of the median in describing data compared to the mean (often simply described as the „average“) is that it is not skewed by a small proportion of extremely large or small values, and therefore provides a better representation of the center. Median income, for example, may be a better way to describe the center of the income distribution because increases in the largest incomes alone have no effect on the median. For this reason, the median is of central importance in robust statistics.
From Wikipedia
For this little Python script, I took the data from the requests of my own website, for each day.
import statistics
data = [1152, 961, 2720,1364,1228,1795,1232,2171,2458,1055,2467,3372,4116,2780,4295,6745,7676,5692,1785,5425,5492,3796,4917,3416,2531,1112,7011,3433,2628,1753]
print('mean', round(statistics.mean(data),2))
print('median', statistics.median(data))
The output is:
mean 3219.27
median 2674.0