-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Fix an inconvenience in quantiles() by supporting input lists of length one, much like min(), max(), mean() and median() 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_summary
from statistics import quantiles
import random
stream = (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
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error