Skip to main content

A small statistics package for data science students and enthusiasts

Project description

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.

Installation

Use the package manager pip to install stat-basket.

pip install statbasket

Usage

The statbasket package includes two classes, StatBasket and StatMe.

StatBasket

Using the StatBasket class generates all statistical data on initialization, and individual statistics can be accessed via the StatBasket object attributes:

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)

Output:

5
25.4

A string summary of the statistics can be generated using the describe() method:

print(basket.describe())

Output:


________________________________________________
|==============================================|
|           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 (mean)                25.4      |
|       Median (median)              26.0      |
|         Mode (mode)             multimodal   |
|            Range                   29.0      |
|       Skewness (skew)             0.034      |
|==============================================|
|------------Measures of Variation-------------|
|==============================================|
|        Variance (var)             167.3      |
|  Standard Deviation (stdev)       12.934     |
|    Standard Error (sterr)         5.784      |
|  Coeff. of Variation (cov)        0.509      |
|==============================================|
|--------Confidence Interval Statistics--------|
|==============================================|
|    Confidence Level (cl)           0.95      |
|      alpha, two-tailed            0.025      |
|   t-score (score_critical)        2.776      |
|    Margin of Error (moe)          16.058     |
| CI (mean - moe, mean + moe)  [9.342, 41.458] |
------------------------------------------------

StatMe

Alternatively, if you want to perform 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 operations 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)

View the individual class docstrings for a full list of available attributes and methods:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

statbasket-1.0.0.tar.gz (17.8 kB view details)

Uploaded Source

File details

Details for the file statbasket-1.0.0.tar.gz.

File metadata

  • Download URL: statbasket-1.0.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.1

File hashes

Hashes for statbasket-1.0.0.tar.gz
Algorithm Hash digest
SHA256 74d12981662fde523aacf1546d0fe9f0716069ab8e73a2af40be0f69886f33c4
MD5 fb73b16777abc6190e8d7475175e6db2
BLAKE2b-256 2e0a56a827ecec86f4eb71c248e2c2b57e9a36c4cc69b7f156d1553907e2308d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page