text_histogram
Histograms are great for exploring data, but numpy and matplotlib are heavy and overkill for quick analysis. They also can’t be easily used on remote servers over ssh. Don’t even get me started on installing them.
Bit.ly’s data_hacks histogram.py is great but difficult to use from python code directly (it requires an optparse.OptionParser to pass histogram options). This is histogram.py repackaged for convenient script use.
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from text_histogram import histogram
>>> histogram([1, 2, 2, 2, 2, 3, 3, 3], graph_char='#')
# NumSamples = 8; Min = 1.00; Max = 3.00
# Mean = 2.250000; Variance = 0.437500; SD = 0.661438; Median 2.000000
# each # represents a count of 1
1.0000 - 1.2000 [ 1]: #
1.2000 - 1.4000 [ 0]:
1.4000 - 1.6000 [ 0]:
1.6000 - 1.8000 [ 0]:
1.8000 - 2.0000 [ 4]: ####
2.0000 - 2.2000 [ 0]:
2.2000 - 2.4000 [ 0]:
2.4000 - 2.6000 [ 0]:
2.6000 - 2.8000 [ 0]:
2.8000 - 3.0000 [ 3]: ###
>>> histogram([1, 2, 2, 2, 2, 3, 3, 3], graph_char='#', display_empty_buckets=False)
# NumSamples = 8; Min = 1.00; Max = 3.00
# Mean = 2.250000; Variance = 0.437500; SD = 0.661438; Median 2.000000
# each # represents a count of 1
1.0000 - 1.2000 [ 1]: #
1.8000 - 2.0000 [ 4]: ####
2.8000 - 3.0000 [ 3]: ###
Installation
pip uninstall text_histogram text_histogram3 # avoid conflicts
pip install text_histogram32
Source: https://github.com/clach04/text_histogram32
Fork of https://github.com/Kobold/text_histogram with a few tweaks:
Same name space as original text_histogram
Python 3 and 2.7 support
Support for control over character used for the bar (see graph_char and DEFAULT_graph_char option)
Support for NOT displaying empty buckets/bins/intervals (see display_empty_buckets and DEFAULT_display_empty_buckets option)
- Fixes
https://github.com/Kobold/text_histogram/issues/4 - Zero for min or max value
when min == max value
improved error handling for empty data sets
ToDo items
Improve dynamic sizing of string and bar
Support for non-linear buckets/bins/intervals (see display_empty_buckets option)?
Support for Scott’s rule https://en.wikipedia.org/wiki/Scott%27s_rule ?
Bug? https://github.com/Kobold/text_histogram/issues/2 https://github.com/bitly/data_hacks/pull/22
Metadata
Release files for text-histogram32 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| text_histogram32-0.0.7.tar.gz | 5.4 kB | Without provenance | Details |
Release files / text_histogram32-0.0.7.tar.gz
| Download URL | text_histogram32-0.0.7.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e15c0629ac115f84fedda602c81395cefa027cbf916f441cfc2457fdf582cb6
|
|
BLAKE2b-256 checksum How to use checksums |
69d4780471e59f1a38f4845d07035fff22a21bdf21f26e3e6d7b7c135a14403e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|
Security for text-histogram32 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.