Simple statistics module
amtStats is a Python 3 package that provides a very simplistic statistics on a dataset. It does not require the use of Numpy.
- The following statistics are available:
- quantile: Q1, Q3, InterQuantile Range (IQR)
- percentiles: 10th, 30th, 50th, 70th, 90th, 95th, 97th and 99th
Install with pip:
pip install amtstats
Import the Statistics class in your python code and then instantiate it.
from amtStats import Statistics myStats = Statistics()
Use update to add numbers (int or float) to the data set.
# add some integer numbers for i in range(100): myStats.update(random.randint(1, 1000)) # and some float for i in range(50): myStats.update(random.random()*100)
Use compute to compute the statistics for the dataset. The result is returned as a Python dictionary (dict).
results = myStats.compute() mean = results['mean']
The mean, median and percentiles are rounded to the 3rd decimal. The standard deviation (stddev) is rounded to the 7th decimal.
The algorithm used to compute the percentiles is compatible with Numpy. They give the same results over the same dataset.
To access the value for a particular percentile, the characters ‘th’ should be added to the value:
# retrieve the 10th and 50th percentiles x10 = results['10th'] x50 = results['50th']
Changing the percentiles
new_list = [5, 15, 25, 35, 45] old_list = myStats.percentiles(new_list) results = myStats.compute()
This package is released under the Apache License 2.0. See the bundled LICENSE file for details.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size amtStats-1.1.0-py3-none-any.whl (9.0 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size amtStats-1.1.0.tar.gz (4.9 kB)||File type Source||Python version None||Upload date||Hashes View hashes|