Welcome to boost-histogram’s documentation!

Boost histogram logo

Welcome to boost-histogram’s documentation!#

Actions Status Documentation Status PyPI version Conda-Forge PyPI platforms DOI GitHub Discussion Gitter Scikit-HEP

Boost-histogram (source) is a Python package providing Python bindings for Boost.Histogram (source). You can install this library from PyPI with pip or you can use Conda via conda-forge:

python -m pip install boost-histogram
conda install -c conda-forge boost-histogram

All the normal best-practices for Python apply; you should be in a virtual environment, etc. See Installation for more details. An example of usage:

import boost_histogram as bh

# Compose axis however you like; this is a 2D histogram
hist = bh.Histogram(bh.axis.Regular(2, 0, 1), bh.axis.Regular(4, 0.0, 1.0))

# Filling can be done with arrays, one per dimension
hist.fill([0.3, 0.5, 0.2], [0.1, 0.4, 0.9])

# NumPy array view into histogram counts, no overflow bins
counts = hist.view()

See Quickstart for more.


This library was primarily developed by Henry Schreiner and Hans Dembinski.

Support for this work was provided by the National Science Foundation cooperative agreement OAC-1836650 (IRIS-HEP) and OAC-1450377 (DIANA/HEP). Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.

Indices and tables#