Registry / data / fast-histogram

fast-histogram

JSON →
library0.14pypypi✓ verified 89d ago

Fast simple 1D and 2D histograms for Python, using C extensions. Current version: 0.14, released 2024-08-12. Cadence: irregular.

pip install fast-histogram
INSTALL
IMPORT
SIG · FAST-HISTOGRAM
F
fast-histogram
datapythonv0.14
Install
3.5s avg
Import
250ms
Disk
89MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.14 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.238s · 89.5MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 3.5s · import 0.262s · 86MB
89MB installed
● package 89MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

histogram1d
✓ from fast_histogram import histogram1d
✗ from fasthistogram import histogram1d
Module name uses underscore, not hyphen
histogram2d
✓ from fast_histogram import histogram2d
✗ from fast_histogram import histogram2d
Correct import path

Compute a 1D histogram with 50 bins over range [-3, 3].

import numpy as np from fast_histogram import histogram1d data = np.random.randn(1000) bins = 50 range_vals = (-3, 3) h = histogram1d(data, bins=bins, range=range_vals) print(h.shape)
Debug
Known issues
breakingv0.13 dropped support for Python <=3.8 and requires numpy >= 1.20, v0.14 requires Python >=3.9 and numpy >= 1.22 to support numpy 2.0.
fix
Upgrade to v0.14 and ensure Python 3.9+ and numpy >=1.22.
affects: <0.13
gotchaThe range argument must be provided explicitly; it defaults to None which raises an error.
fix
Always specify range as a tuple (min, max) or (xmin, xmax, ymin, ymax) for 2D.
affects: all
deprecatedThe numpy.histogram and numpy.histogram2d are slower; this library is intended as a drop-in replacement but weights behavior differs slightly.
fix
Check that weights are handled identically; fast-histogram does not support normed/density directly.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'fast_histogram'
Trying to import from 'fast_histogram' but installed package is 'fast-histogram'.
fix
Install correctly: pip install fast-histogram. Then import: from fast_histogram import histogram1d
ValueError: The 'range' argument is required
range not provided or set to None.
fix
Always provide a range tuple, e.g., histogram1d(data, bins=50, range=(-3, 3))
Upgrade
Version history
0.14latest on PyPI · released Apr 16, 2024
Audit
Dependencies
numpyrequiredCore dependency for array operations
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
2
Amazon
1
Resources
fast-histogram — pip install fast-histogram · libregistry