WeightedStats
Python functions to calculate the mean, weighted mean, median, and weighted median.
Installation
The easiest way to install WeightedStats is to use pip:
$ pip install weightedstats
Usage
WeightedStats includes four functions (mean, weighted_mean, median, weighted_median) which accept lists as arguments, and two functions (numpy_weighted_mean, numpy weighted_median) which accept either lists or numpy arrays.
Example:
import weightedstats as ws
my_data = [1, 2, 3, 4, 5]
my_weights = [10, 1, 1, 1, 9]
# Ordinary (unweighted) mean and median
ws.mean(my_data) # equivalent to ws.weighted_mean(my_data)
ws.median(my_data) # equivalent to ws.weighted_median(my_data)
# Weighted mean and median
ws.weighted_mean(my_data, weights=my_weights)
ws.weighted_median(my_data, weights=my_weights)
# Special weighted mean and median functions for use with numpy arrays
ws.numpy_weighted_mean(my_data, weights=my_weights)
ws.numpy_weighted_median(my_data, weights=my_weights)
Tests
Unit tests are in the test/ directory.
Metadata
Release files for weightedstats 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| weightedstats-0.4.1.tar.gz | 4.3 kB | Without provenance | Details for weightedstats-0.4.1.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| weightedstats-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for weightedstats-0.4.1-py3-none-any.whl |
| weightedstats-0.4.1-py2-none-any.whl | Python 2 | none | any | Details for weightedstats-0.4.1-py2-none-any.whl |
Total release size: 12.0 kB
Release files / weightedstats-0.4.1.tar.gz
| Download URL | weightedstats-0.4.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
beb488a3f46aa06dbc8491578ec7e408847ca682edc7ec90846f6df9e36cab50
|
|
BLAKE2b-256 checksum How to use checksums |
daa5f5c0e601a610e4618316be3155febbbec98994788fcc0e9d8080369266ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.17
|
Release files / weightedstats-0.4.1-py3-none-any.whl
| Download URL | weightedstats-0.4.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ead0c27df10b0598d7e3a1c2bc201b925f5ac47099df0dafccce91932a5d155
|
|
BLAKE2b-256 checksum How to use checksums |
8d7324ecd3d2230edb304d8c2febe61711ae75c11fc792acc8fd3b056b4eb6cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.17
|
Release files / weightedstats-0.4.1-py2-none-any.whl
| Download URL | weightedstats-0.4.1-py2-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
5633991d01864dca581816da3070eed95fb3671020937a8dbad7afab4a38ef0c
|
|
BLAKE2b-256 checksum How to use checksums |
4ac7bd3aea4766db65f7da86753450c80a786bddbb2a11db2f9667376ec14910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.17
|
Security for weightedstats 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.