{"id":19098255,"url":"https://github.com/scikit-hep/hist","last_synced_at":"2026-02-04T00:04:20.183Z","repository":{"id":37072525,"uuid":"239605861","full_name":"scikit-hep/hist","owner":"scikit-hep","description":"Histogramming for analysis powered by boost-histogram","archived":false,"fork":false,"pushed_at":"2025-03-28T21:40:25.000Z","size":4569,"stargazers_count":128,"open_issues_count":86,"forks_count":26,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-31T21:47:44.521Z","etag":null,"topics":["histogram","python","scikit-hep"],"latest_commit_sha":null,"homepage":"https://hist.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scikit-hep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":"docs/support.rst","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-10T20:24:52.000Z","updated_at":"2025-03-28T21:39:56.000Z","dependencies_parsed_at":"2023-02-16T23:30:47.521Z","dependency_job_id":"64143b68-1103-41d7-a4aa-e56b325aa8bc","html_url":"https://github.com/scikit-hep/hist","commit_stats":{"total_commits":460,"total_committers":22,"mean_commits":20.90909090909091,"dds":0.567391304347826,"last_synced_commit":"020eed7d8d28e33a2358251e959dc38137238723"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-hep%2Fhist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-hep%2Fhist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-hep%2Fhist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-hep%2Fhist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scikit-hep","download_url":"https://codeload.github.com/scikit-hep/hist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247737770,"owners_count":20987718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["histogram","python","scikit-hep"],"created_at":"2024-11-09T03:44:47.035Z","updated_at":"2026-02-04T00:04:20.175Z","avatar_url":"https://github.com/scikit-hep.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":["Aggregation/histogram filling"],"readme":"\u003cimg alt=\"histogram\" width=\"200\" src=\"https://raw.githubusercontent.com/scikit-hep/hist/main/docs/_images/histlogo.png\"/\u003e\n\n# Hist\n\n[![Actions Status][actions-badge]][actions-link]\n[![Documentation Status][rtd-badge]][rtd-link]\n[![pre-commit.ci status][pre-commit-badge]][pre-commit-link]\n\n[![PyPI version][pypi-version]][pypi-link]\n[![Conda-Forge][conda-badge]][conda-link]\n[![PyPI platforms][pypi-platforms]][pypi-link]\n[![DOI][doi-badge]][doi-link]\n[![License][license-badge]][license-link]\n\n[![GitHub Discussion][github-discussions-badge]][github-discussions-link]\n[![Gitter][gitter-badge]][gitter-link]\n[![Binder][binder-badge]][binder-link]\n[![Scikit-HEP][sk-badge]][sk-link]\n[![SPEC 4 — Using and Creating Nightly Wheels][spec4-badge]][spec4-link]\n\nHist is an analyst-friendly front-end for\n[boost-histogram](https://github.com/scikit-hep/boost-histogram), designed for\nPython 3.10+ (3.6-3.9 users get older versions). See [what's new](https://hist.readthedocs.io/en/latest/changelog.html).\n\n![Slideshow of features. See docs/banner_slides.md for text if the image is not readable.](https://github.com/scikit-hep/hist/raw/main/docs/_images/banner.gif)\n\n## Installation\n\nYou can install this library from [PyPI](https://pypi.org/project/hist/) with pip:\n\n```bash\npython3 -m pip install \"hist[plot,fit]\"\n```\n\nIf you do not need the plotting features, you can skip the `[plot]` and/or\n`[fit]` extras. `[fit]` is not currently supported in WebAssembly.\n\n## Features\n\nHist currently provides everything boost-histogram provides, and the following enhancements:\n\n- Hist augments axes with names:\n  - `name=` is a unique label describing each axis.\n  - `label=` is an optional string that is used in plotting (defaults to `name`\n    if not provided).\n  - Indexing, projection, and more support named axes.\n  - Experimental `NamedHist` is a `Hist` that disables most forms of positional access, forcing users to use only names.\n\n- The `Hist` class augments `bh.Histogram` with simpler construction:\n  - `flow=False` is a fast way to turn off flow for the axes on construction.\n  - `storage=` can be omitted, strings and storages can be positional.\n  - `data=` can initialize a histogram with existing data.\n  - `Hist.from_columns` can be used to initialize with a DataFrame or dict.\n  - You can cast back and forth with boost-histogram (or any other extensions).\n\n- Hist support QuickConstruct, an import-free construction system that does not require extra imports:\n  - Use `Hist.new.\u003caxis\u003e().\u003caxis\u003e().\u003cstorage\u003e()`.\n  - Axes names can be full (`Regular`) or short (`Reg`).\n  - Histogram arguments (like `data=`) can go in the storage.\n\n- Extended Histogram features:\n  - Direct support for `.name` and `.label`, like axes.\n  - `.density()` computes the density as an array.\n  - `.profile(remove_ax)` can convert a ND COUNT histogram into a (N-1)D MEAN histogram.\n  - `.sort(axis)` supports sorting a histogram by a categorical axis. Optionally takes a function to sort by.\n  - `.fill_flattened(...)` will flatten and fill, including support for AwkwardArray.\n  - `.integrate(...)`, which takes the opposite arguments as `.project`.\n\n- Hist implements UHI+; an extension to the UHI (Unified Histogram Indexing) system designed for import-free interactivity:\n  - Uses `j` suffix to switch to data coordinates in access or slices.\n  - Uses `j` suffix on slices to rebin.\n  - Strings can be used directly to index into string category axes.\n\n- Quick plotting routines encourage exploration:\n  - `.plot()` provides 1D and 2D plots (or use `plot1d()`, `plot2d()`)\n  - `.plot2d_full()` shows 1D projects around a 2D plot.\n  - `.plot_ratio(...)` make a ratio plot between the histogram and another histogram or callable.\n  - `.plot_pull(...)` performs a pull plot.\n  - `.plot_pie()` makes a pie plot.\n  - `.show()` provides a nice str printout using Histoprint.\n\n- Stacks: work with groups of histograms with identical axes\n  - Stacks can be created with `h.stack(axis)`, using index or name of an axis (`StrCategory` axes ideal).\n  - You can also create with `hist.stacks.Stack(h1, h2, ...)`, or use `from_iter` or `from_dict`.\n  - You can index a stack, and set an entry with a matching histogram.\n  - Stacks support `.plot()` and `.show()`, with names (plot labels default to original axes info).\n  - Stacks pass through `.project`, `*`, `+`, and `-`.\n\n- New modules\n  - `intervals` supports frequentist coverage intervals.\n\n- Notebook ready: Hist has gorgeous in-notebook representation.\n  - No dependencies required\n\n## Usage\n\n```python\nfrom hist import Hist\n\n# Quick construction, no other imports needed:\nh = (\n    Hist.new.Reg(10, 0, 1, name=\"x\", label=\"x-axis\")\n    .Var(range(10), name=\"y\", label=\"y-axis\")\n    .Int64()\n)\n\n# Filling by names is allowed:\nh.fill(y=[1, 4, 6], x=[0.3, 0.5, 0.2])\n\n# Names can be used to manipulate the histogram:\nh.project(\"x\")\nh[{\"y\": 0.5j + 3, \"x\": 5j}]\n\n# You can access data coordinates or rebin with a `j` suffix:\nh[0.3j:, ::2j]  # x from .3 to the end, y is rebinned by 2\n\n# Elegant plotting functions:\nh.plot()\nh.plot2d_full()\nh.plot_pull(Callable)\n```\n\n## Development\n\nFrom a git checkout, either use [nox](https://nox.thea.codes), or run:\n\n```bash\npython -m pip install -e .[dev]\n```\n\nSee [Contributing](https://hist.readthedocs.io/en/latest/contributing.html) guidelines for information on setting up a development environment.\n\n## Contributors\n\nWe would like to acknowledge the contributors that made this project possible ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/henryiii\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/4616906?v=4?s=100\" width=\"100px;\" alt=\"Henry Schreiner\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eHenry Schreiner\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#maintenance-henryiii\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/scikit-hep/hist/commits?author=henryiii\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/scikit-hep/hist/commits?author=henryiii\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://lovelybuggies.com.cn/\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/29083689?v=4?s=100\" width=\"100px;\" alt=\"Nino Lau\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNino Lau\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#maintenance-LovelyBuggies\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/scikit-hep/hist/commits?author=LovelyBuggies\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/scikit-hep/hist/commits?author=LovelyBuggies\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/chrisburr\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/5220533?v=4?s=100\" width=\"100px;\" alt=\"Chris Burr\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eChris Burr\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=chrisburr\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/aminnj\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/5760027?v=4?s=100\" width=\"100px;\" alt=\"Nick Amin\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNick Amin\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=aminnj\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://cern.ch/eduardo.rodrigues\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/5013581?v=4?s=100\" width=\"100px;\" alt=\"Eduardo Rodrigues\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eEduardo Rodrigues\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=eduardo-rodrigues\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://andrzejnovak.github.io/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/13226500?v=4?s=100\" width=\"100px;\" alt=\"Andrzej Novak\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAndrzej Novak\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=andrzejnovak\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://www.matthewfeickert.com/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/5142394?v=4?s=100\" width=\"100px;\" alt=\"Matthew Feickert\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMatthew Feickert\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=matthewfeickert\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://theoryandpractice.org\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/4458890?v=4?s=100\" width=\"100px;\" alt=\"Kyle Cranmer\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKyle Cranmer\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=cranmer\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://dantrim.github.io\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/7841565?v=4?s=100\" width=\"100px;\" alt=\"Daniel Antrim\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDaniel Antrim\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=dantrim\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/nsmith-\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/6587412?v=4?s=100\" width=\"100px;\" alt=\"Nicholas Smith\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNicholas Smith\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=nsmith-\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://meliache.srht.site\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/5121824?v=4?s=100\" width=\"100px;\" alt=\"Michael Eliachevitch\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMichael Eliachevitch\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=meliache\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/jonas-eschle\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/17454848?v=4?s=100\" width=\"100px;\" alt=\"Jonas Eschle\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJonas Eschle\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=jonas-eschle\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://oieltd.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1248413?v=4?s=100\" width=\"100px;\" alt=\"Angus Hollands\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAngus Hollands\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/scikit-hep/hist/commits?author=agoose77\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/scikit-hep/hist/commits?author=agoose77\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.\n\n## Talks\n\n- [2021-07-07 PyHEP 2021 -- High-Performance Histogramming for HEP Analysis](https://indico.cern.ch/event/1019958/contributions/4430375/) [🎥](https://youtu.be/jewb5q6_Rpk)\n- [2020-09-08 IRIS-HEP/GSOC -- Hist: histogramming for analysis powered by boost-histogram](https://indico.cern.ch/event/950229/#3-hist-histogramming-for-analy) [🎥](https://www.youtube.com/watch?v=hIiEu7XFu5Y)\n- [2020-07-07 SciPy Proceedings](https://www.youtube.com/watch?v=ERraTfHkPd0\u0026list=PLYx7XA2nY5GfY4WWJjG5cQZDc7DIUmn6Z\u0026index=4) [🎥](https://youtu.be/ERraTfHkPd0)\n- [2020-07-17 PyHEP 2020](https://indico.cern.ch/event/882824/contributions/3931299/) [🎥](https://youtu.be/-g0mxopCJT8)\n\n---\n\n## Acknowledgements\n\nThis library was primarily developed by Henry Schreiner and Nino Lau.\n\nSupport 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.\n\n[actions-badge]:            https://github.com/scikit-hep/hist/workflows/CI/badge.svg\n[actions-link]:             https://github.com/scikit-hep/hist/actions\n[binder-badge]:             https://mybinder.org/badge_logo.svg\n[binder-link]:              https://mybinder.org/v2/gh/scikit-hep/hist/HEAD\n[conda-badge]:              https://img.shields.io/conda/vn/conda-forge/hist\n[conda-link]:               https://github.com/conda-forge/hist-feedstock\n[doi-badge]:                https://zenodo.org/badge/239605861.svg\n[doi-link]:                 https://zenodo.org/badge/latestdoi/239605861\n[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions\u0026message=Ask\u0026color=blue\u0026logo=github\n[github-discussions-link]:  https://github.com/scikit-hep/hist/discussions\n[gitter-badge]:             https://badges.gitter.im/HSF/PyHEP-histogramming.svg\n[gitter-link]:              https://gitter.im/HSF/PyHEP-histogramming?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\n[license-badge]:            https://img.shields.io/badge/License-BSD_3--Clause-blue.svg\n[license-link]:             https://opensource.org/licenses/BSD-3-Clause\n[pre-commit-badge]:         https://results.pre-commit.ci/badge/github/scikit-hep/hist/main.svg\n[pre-commit-link]:          https://results.pre-commit.ci/repo/github/scikit-hep/hist\n[pypi-link]:                https://pypi.org/project/hist/\n[pypi-platforms]:           https://img.shields.io/pypi/pyversions/hist\n[pypi-version]:             https://badge.fury.io/py/hist.svg\n[rtd-badge]:                https://readthedocs.org/projects/hist/badge/?version=latest\n[rtd-link]:                 https://hist.readthedocs.io/en/latest/?badge=latest\n[sk-badge]:                 https://scikit-hep.org/assets/images/Scikit--HEP-Project-blue.svg\n[sk-link]:                  https://scikit-hep.org/\n[spec4-badge]:              https://img.shields.io/badge/SPEC-4-green?labelColor=%23004811\u0026color=%235CA038\n[spec4-link]:               https://scientific-python.org/specs/spec-0004/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscikit-hep%2Fhist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscikit-hep%2Fhist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscikit-hep%2Fhist/lists"}