Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional weights parameter to statistics.fmean() #88316

Closed
rhettinger opened this issue May 16, 2021 · 1 comment
Closed

Add optional weights parameter to statistics.fmean() #88316

rhettinger opened this issue May 16, 2021 · 1 comment
Labels
3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@rhettinger
Copy link
Contributor

BPO 44150
Nosy @rhettinger, @stevendaprano
PRs
  • bpo-44150: Support optional weights parameter for fmean() #26175
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-05-21.03:22:49.037>
    created_at = <Date 2021-05-16.18:56:52.909>
    labels = ['type-feature', 'library', '3.11']
    title = 'Add optional weights parameter to statistics.fmean()'
    updated_at = <Date 2021-05-21.03:22:49.037>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2021-05-21.03:22:49.037>
    actor = 'rhettinger'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-05-21.03:22:49.037>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2021-05-16.18:56:52.909>
    creator = 'rhettinger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44150
    keywords = ['patch']
    message_count = 1.0
    messages = ['393751']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'steven.daprano']
    pr_nums = ['26175']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44150'
    versions = ['Python 3.11']

    @rhettinger
    Copy link
    Contributor Author

    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.

    @rhettinger rhettinger added 3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 16, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant