A simple statistics library
Project description
statlib
A small statistics library providing common descriptive and inferential statistics functions, grouped-data helpers, and basic probability utilities. The package appears authored by Abdulrahman F. Alosaimi.
Project layout
statlib/formula.py- main implementation of statistical functionsstatlib/unit_tests.py- unit tests for several core functions
Usage
Import the functions you need from statlib:
from statlib import formula
print(formula.mean([1,2,3,4,5], 5))
Key functions (summary)
The formula.py module implements many functions. Highlights:
-
Data description
mean(x, n)— sample meanmedine(data)— median (handles even/odd lengths)mid_range(highest, lowest)mid_point(h_limit, l_limit)mod(data)— mode (returns list with mode and its frequency when applicable)
-
Grouped data helpers
mean_for_grouped_data(x, f, n)— mean for grouped data using class midpointsmedine_for_grouped_data(f, cumulative_f)— median for grouped data (expects class rows[lower, upper, freq, cumulative_freq])
-
Variation & dispersion
rnge(high, low)— rangepop_variance,standard_deviation_popsample_variance,standard_deviation_samplevariance_groupedcoff_of_variation_sample,coff_of_variation_pop
-
Percentiles & z-scores
percent,relative_frequncy,coumulative_frequncy_percentile,percentile,percentile_to_valuez_scores_pop,z_scores_sample
-
Outliers & quartiles
quar_of(data)— returns [Q1, Q2, Q3]outlier(data)— returns [lower_limit, upper_limit, list_of_outliers]
-
Correlation & regression
correlation_coefficient(data, n)regression_line(data, n, x)— predicts y for given x using linear regression
-
Probability & counting
prob,emprical_prob,event_comp,Bayes_prob,independ_intersect_prob,depend_intersect_probpermu_count,comb_count
Contributing
Feel free to open issues or PRs. Small improvements I'd prioritize:
- Fix arithmetic bugs and replace
=+with+=where needed - Add more unit tests and type hints
- Standardize naming and export a cleaner public API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file statilib-0.1.0.tar.gz.
File metadata
- Download URL: statilib-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e0c85038dbc809fbf7486cc17973ac68cd41eb114e2f26b16193fa84293b78f
|
|
| MD5 |
55b83aa09a7e07f65b88d70bc2d2fb08
|
|
| BLAKE2b-256 |
f467cfc0255254e3660267ba7a0883401cc751162264d88f2dfdb0c11d8d06e2
|
File details
Details for the file statilib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: statilib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d131a78706851a9825722c5dc398f0288ed86ac8f5dd06bcd42d9cce993559bd
|
|
| MD5 |
2fa25beed12669362c8541552eb42414
|
|
| BLAKE2b-256 |
b7369e286b86c62d3e77ec13fc512510ac2c6df66ea7c72c56d790acf34783af
|