{"id":23706,"library":"fast-histogram","title":"fast-histogram","description":"Fast simple 1D and 2D histograms for Python, using C extensions. Current version: 0.14, released 2024-08-12. Cadence: irregular.","status":"active","version":"0.14","language":"python","source_language":"en","source_url":"https://github.com/astrofrog/fast-histogram","tags":["histogram","fast","numpy","1d","2d"],"install":[{"cmd":"pip install fast-histogram","lang":"bash","label":"Install"}],"dependencies":[{"reason":"Core dependency for array operations","package":"numpy","optional":false}],"imports":[{"note":"Module name uses underscore, not hyphen","wrong":"from fasthistogram import histogram1d","symbol":"histogram1d","correct":"from fast_histogram import histogram1d"},{"note":"Correct import path","wrong":"from fast_histogram import histogram2d","symbol":"histogram2d","correct":"from fast_histogram import histogram2d"}],"quickstart":{"code":"import numpy as np\nfrom fast_histogram import histogram1d\n\ndata = np.random.randn(1000)\nbins = 50\nrange_vals = (-3, 3)\n\nh = histogram1d(data, bins=bins, range=range_vals)\nprint(h.shape)","lang":"python","description":"Compute a 1D histogram with 50 bins over range [-3, 3]."},"warnings":[{"fix":"Upgrade to v0.14 and ensure Python 3.9+ and numpy >=1.22.","message":"v0.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.","severity":"breaking","affected_versions":"<0.13"},{"fix":"Always specify range as a tuple (min, max) or (xmin, xmax, ymin, ymax) for 2D.","message":"The range argument must be provided explicitly; it defaults to None which raises an error.","severity":"gotcha","affected_versions":"all"},{"fix":"Check that weights are handled identically; fast-histogram does not support normed/density directly.","message":"The numpy.histogram and numpy.histogram2d are slower; this library is intended as a drop-in replacement but weights behavior differs slightly.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install correctly: pip install fast-histogram. Then import: from fast_histogram import histogram1d","cause":"Trying to import from 'fast_histogram' but installed package is 'fast-histogram'.","error":"ModuleNotFoundError: No module named 'fast_histogram'"},{"fix":"Always provide a range tuple, e.g., histogram1d(data, bins=50, range=(-3, 3))","cause":"range not provided or set to None.","error":"ValueError: The 'range' argument is required"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}