WeightedStats
=============
.. image:: https://travis-ci.org/tinybike/weightedstats.svg?branch=master
:target: https://travis-ci.org/tinybike/weightedstats
.. image:: https://coveralls.io/repos/github/tinybike/weightedstats/badge.svg?branch=master :target: https://coveralls.io/github/tinybike/weightedstats?branch=master
.. image:: https://badge.fury.io/py/weightedstats.svg
:target: http://badge.fury.io/py/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:
.. code-block:: python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/tinybike/weightedstats",
"name": "weightedstats",
"maintainer": "Jack Peterson",
"docs_url": null,
"requires_python": "",
"maintainer_email": "<jack@tinybike.net>",
"keywords": "weights,mean,median,numpy,statistics",
"author": "Jack Peterson",
"author_email": "<jack@tinybike.net>",
"download_url": "https://files.pythonhosted.org/packages/da/a5/f5c0e601a610e4618316be3155febbbec98994788fcc0e9d8080369266ec/weightedstats-0.4.1.tar.gz",
"platform": "",
"description": "WeightedStats\n=============\n\n.. image:: https://travis-ci.org/tinybike/weightedstats.svg?branch=master\n :target: https://travis-ci.org/tinybike/weightedstats\n\n.. image:: https://coveralls.io/repos/github/tinybike/weightedstats/badge.svg?branch=master :target: https://coveralls.io/github/tinybike/weightedstats?branch=master\n\n.. image:: https://badge.fury.io/py/weightedstats.svg\n :target: http://badge.fury.io/py/weightedstats\n\nPython functions to calculate the mean, weighted mean, median, and weighted median.\n\nInstallation\n^^^^^^^^^^^^\n\nThe easiest way to install WeightedStats is to use pip::\n\n $ pip install weightedstats\n\nUsage\n^^^^^\n\nWeightedStats 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.\n\nExample:\n\n.. code-block:: python\n\n import weightedstats as ws\n\n my_data = [1, 2, 3, 4, 5]\n my_weights = [10, 1, 1, 1, 9]\n\n # Ordinary (unweighted) mean and median\n ws.mean(my_data) # equivalent to ws.weighted_mean(my_data)\n ws.median(my_data) # equivalent to ws.weighted_median(my_data)\n\n # Weighted mean and median\n ws.weighted_mean(my_data, weights=my_weights)\n ws.weighted_median(my_data, weights=my_weights)\n\n # Special weighted mean and median functions for use with numpy arrays\n ws.numpy_weighted_mean(my_data, weights=my_weights)\n ws.numpy_weighted_median(my_data, weights=my_weights)\n\nTests\n^^^^^\n\nUnit tests are in the test/ directory.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Mean, weighted mean, median, weighted median",
"version": "0.4.1",
"project_urls": {
"Download": "https://github.com/tinybike/weightedstats/tarball/0.4.1",
"Homepage": "https://github.com/tinybike/weightedstats"
},
"split_keywords": [
"weights",
"mean",
"median",
"numpy",
"statistics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4ac7bd3aea4766db65f7da86753450c80a786bddbb2a11db2f9667376ec14910",
"md5": "83020234e29603d365fa7f584c684cbf",
"sha256": "5633991d01864dca581816da3070eed95fb3671020937a8dbad7afab4a38ef0c"
},
"downloads": -1,
"filename": "weightedstats-0.4.1-py2-none-any.whl",
"has_sig": false,
"md5_digest": "83020234e29603d365fa7f584c684cbf",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 3812,
"upload_time": "2020-02-04T22:46:29",
"upload_time_iso_8601": "2020-02-04T22:46:29.061816Z",
"url": "https://files.pythonhosted.org/packages/4a/c7/bd3aea4766db65f7da86753450c80a786bddbb2a11db2f9667376ec14910/weightedstats-0.4.1-py2-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8d7324ecd3d2230edb304d8c2febe61711ae75c11fc792acc8fd3b056b4eb6cc",
"md5": "9fd33eb4e0fd37ae53013243deee3c8b",
"sha256": "6ead0c27df10b0598d7e3a1c2bc201b925f5ac47099df0dafccce91932a5d155"
},
"downloads": -1,
"filename": "weightedstats-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9fd33eb4e0fd37ae53013243deee3c8b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3812,
"upload_time": "2020-02-04T22:46:30",
"upload_time_iso_8601": "2020-02-04T22:46:30.401252Z",
"url": "https://files.pythonhosted.org/packages/8d/73/24ecd3d2230edb304d8c2febe61711ae75c11fc792acc8fd3b056b4eb6cc/weightedstats-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "daa5f5c0e601a610e4618316be3155febbbec98994788fcc0e9d8080369266ec",
"md5": "f5cac13564b15e49a4eee9ca6d195ca4",
"sha256": "beb488a3f46aa06dbc8491578ec7e408847ca682edc7ec90846f6df9e36cab50"
},
"downloads": -1,
"filename": "weightedstats-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "f5cac13564b15e49a4eee9ca6d195ca4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4327,
"upload_time": "2020-02-04T22:46:32",
"upload_time_iso_8601": "2020-02-04T22:46:32.246323Z",
"url": "https://files.pythonhosted.org/packages/da/a5/f5c0e601a610e4618316be3155febbbec98994788fcc0e9d8080369266ec/weightedstats-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-02-04 22:46:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tinybike",
"github_project": "weightedstats",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"test_requirements": [],
"lcname": "weightedstats"
}