Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix base case handling in quantiles() #110150

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@rhettinger

Description

@rhettinger

Fix an inconvenience inquantiles() by supporting input lists of length one, much likemin(),max(),mean() andmedian() also support datasets of size one.

The principal use case is making statistical summaries of data streams. It is really inconvenient to require a special case for the first data point. Instead, it is much nicer to make updates as new data arrives, starting with the very first datum.

This is what we want:

"Running five number summary for a data stream"# https://en.wikipedia.org/wiki/Five-number_summaryfrom statistics import quantilesimport randomstream = (random.expovariate() for i in range(20))data = []for x in stream:    data.append(x)    print(min(data), quantiles(data), max(data))

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp