statbasket

A small statistics package for data science students and enthusiasts


Keywords
statistics, data-science, students, lite, pure-python
License
MIT
Install
pip install statbasket==1.0.0

Documentation

Github All Releases Github All Releases Github All Releases Github All Releases

Stat Basket

Stat Basket is a small statistics package intended for use with student projects or small datasets (those containing <1 million data points). It is implemented with pure python, so no external dependencies are required.

statbasket includes two classes, StatMe and StatBasket.

Installation

Use the package manager pip to install stat-basket.

pip install statbasket

Usage

Using the StatBasket class generates all statistical data on initialization.

from statbasket import StatBasket

data = (13, 26, 41, 35, 12)
# Perform all calculations and store in attributes
basket = StatBasket(data, first_data_name="my_data")
print(basket.n)
print(basket.mean)
print(basket.describe())

Output:

5
25.4
________________________________________
|======================================|
|       DESCRIPTION OF my_data         |
|======================================|
|------General Sample Statistics-------|
|======================================|
|  Size of Sample (n)         5        |
| Minimum Value (min)         12       |
| Maximum Value (max)         41       |
|======================================|
|-----Measures of Central Tendency-----|
|======================================|
|         Mean               25.4      |
|        Median              26.0      |
|         Mode            multimodal   |
|        Range               29.0      |
|       Skewness            0.034      |
|======================================|
|--------Measures of Variation---------|
|======================================|
|       Variance            167.3      |
|  Standard Deviation       12.934     |
|    Standard Error         5.784      |
| Coeff. of Variation       0.509      |
|======================================|
|----Confidence Interval Statistics----|
|======================================|
|   Confidence Level         0.95      |
|    α (two-tailed)         0.025      |
|       t-score             2.776      |
| Margin of Error (E)       16.058     |
|    CI (mean ± E)     [9.342, 41.458] |
----------------------------------------

Alternatively, if you want to perform specific calculations on-the-fly, without performing the entire batch of calculations at once, you can use the StatMe class of methods:

from statbasket import StatMe

data = (13, 26, 41, 35, 12)
# Perform single operation on data
mean = StatMe.get_mean(data)
ci = StatMe.get_ci(data, cl=0.99)
print(mean)
print(ci)

Output:

25.4
(-1.2316627975047787, 52.03166279750478)

For a full list of available attributes and methods, view the individual class docstrings, which extensively document the mathematics and functionality of the available methods and attributes.

from statbasket import StatMe, StatBasket
help(StatMe)
help(StatBasket)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

MIT