This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add optional weights parameter to statistics.fmean()
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: rhettinger, steven.daprano
Priority: normal Keywords: patch

Created on 2021-05-16 18:56 by rhettinger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26175 merged rhettinger, 2021-05-16 19:00
Messages (1)
msg393751 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-05-16 18:56
Weighted averages are another basic that we should support.

A professor assigns a grade for a course by weighting quizzes at 20%, homework at 20%, a midterm exam at 30%, and a final exam at 30%:

>>> grades = [85, 92, 83, 91]
>>> weights = [0.20, 0.20, 0.30, 0.30]
>>> fmean(grades, weights)
87.6

The API here matches that for harmonic_mean() and random.choices(), the other places where we support optional weights.
History
Date User Action Args
2022-04-11 14:59:45adminsetgithub: 88316
2021-05-21 03:22:49rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-05-16 19:00:42rhettingersetkeywords: + patch
stage: patch review
pull_requests: + pull_request24800
2021-05-16 18:56:52rhettingercreate