X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=src%2Fpyutils%2Ftypez%2Fhistogram.py;h=d0a755b3b572d46f0dbf407b4d87673db6bbc466;hb=993b0992473c12294ed659e52b532e1c8cf9cd1e;hp=2887525b053991fcec299bc8f2fcf9b8a91fefa4;hpb=b38920f24d1ac948958480c540bc4b8436186765;p=pyutils.git diff --git a/src/pyutils/typez/histogram.py b/src/pyutils/typez/histogram.py index 2887525..d0a755b 100644 --- a/src/pyutils/typez/histogram.py +++ b/src/pyutils/typez/histogram.py @@ -3,7 +3,36 @@ # © Copyright 2021-2022, Scott Gasch -"""A text-based simple histogram helper class.""" +""" +This is a text-based histogram class. It creates output like this: + +A Histogram helper class. Creates outputs like this:: + + [4..5): ▏ ( 0.16% n=1) + [5..6): ██▍ ( 0.64% n=4) + [6..7): ██████▏ ( 1.60% n=10) + [7..8): ████████████▍ ( 3.20% n=20) + [8..9): █████████████████████▊ ( 5.60% n=35) + [9..10): ████████████████████████████████▍ ( 8.32% n=52) + [10..11): ██████████████████████████████████████████▍ (10.88% n=68) + [11..12): █████████████████████████████████████████████████▉ (12.80% n=80) + [12..13): ████████████████████████████████████████████████████▉ (13.60% n=85) + [13..14): █████████████████████████████████████████████████▉ (12.80% n=80) + [14..15): ██████████████████████████████████████████▍ (10.88% n=68) + [15..16): ████████████████████████████████▍ ( 8.32% n=52) + [16..17): █████████████████████▊ ( 5.60% n=35) + [17..18): ████████████▍ ( 3.20% n=20) + [18..19): ██████▏ ( 1.60% n=10) + [19..20): ██▍ ( 0.64% n=4) + [20..21): ▏ ( 0.16% n=1) + -------------------------------------------------------------------------------- + [4..21): pop(Σn)=625 + mean(x̄)=12.000 + median(p50)=12.000 + mode(Mo)=12.000 + stdev(σ)=0.113 + +""" import math from dataclasses import dataclass