awkward

Manipulate JSON-like data with NumPy-like idioms.

https://github.com/scikit-hep/awkward

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    7 of 56 committers (12.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary

Keywords

apache-arrow cern-root columnar-format data-analysis jagged-array json numba numpy pandas python ragged-array rdataframe scikit-hep

Keywords from Contributors

histograms closember jax hep high-energy-physics statistical-inference histfactory hep-ex frequentist-statistics cls
Last synced: 4 months ago · JSON representation ·

Repository

Manipulate JSON-like data with NumPy-like idioms.

Basic Info
  • Host: GitHub
  • Owner: scikit-hep
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage: https://awkward-array.org
  • Size: 26.4 MB
Statistics
  • Stars: 900
  • Watchers: 20
  • Forks: 95
  • Open Issues: 149
  • Releases: 270
Topics
apache-arrow cern-root columnar-format data-analysis jagged-array json numba numpy pandas python ragged-array rdataframe scikit-hep
Created over 6 years ago · Last pushed 4 months ago
Metadata Files
Readme Contributing License Citation

README.md

<!-- end-logo -->

PyPI version Conda-Forge Python 3.9‒3.13 BSD-3 Clause License Build Test

Scikit-HEP DOI Documentation Gitter

NSF-1836650 NSF-2103945 NSF-2121686 NSF-2323298

Awkward Array is a library for nested, variable-sized data, including arbitrary-length lists, records, mixed types, and missing data, using NumPy-like idioms.

Arrays are dynamically typed, but operations on them are compiled and fast. Their behavior coincides with NumPy when array dimensions are regular and generalizes when they're not.

Motivating example

Given an array of lists of objects with x, y fields (with nested lists in the y field),

```python import awkward as ak

array = ak.Array([ [{"x": 1.1, "y": [1]}, {"x": 2.2, "y": [1, 2]}, {"x": 3.3, "y": [1, 2, 3]}], [], [{"x": 4.4, "y": [1, 2, 3, 4]}, {"x": 5.5, "y": [1, 2, 3, 4, 5]}] ]) ```

the following slices out the y values, drops the first element from each inner list, and runs NumPy's np.square function on everything that is left:

python output = np.square(array["y", ..., 1:])

The result is

python [ [[], [4], [4, 9]], [], [[4, 9, 16], [4, 9, 16, 25]] ]

The equivalent using only Python is

python output = [] for sublist in array: tmp1 = [] for record in sublist: tmp2 = [] for number in record["y"][1:]: tmp2.append(np.square(number)) tmp1.append(tmp2) output.append(tmp1)

The expression using Awkward Arrays is more concise, using idioms familiar from NumPy, and it also has NumPy-like performance. For a similar problem 10 million times larger than the one above (single-threaded on a 2.2 GHz processor),

  • the Awkward Array one-liner takes 1.5 seconds to run and uses 2.1 GB of memory,
  • the equivalent using Python lists and dicts takes 140 seconds to run and uses 22 GB of memory.

Awkward Array is even faster when used in Numba's JIT-compiled functions.

See the Getting started documentation on awkward-array.org for an introduction, including a no-install demo you can try in your web browser.

Getting help

Installation

Awkward Array can be installed from PyPI using pip:

bash pip install awkward

The awkward package is pure Python, and it will download the awkward-cpp compiled components as a dependency. If there is no awkward-cpp binary package (wheel) for your platform and Python version, pip will attempt to compile it from source (which has additional dependencies, such as a C++ compiler).

Awkward Array is also available on conda-forge:

bash conda install -c conda-forge awkward

Because of the two packages (awkward-cpp may be updated in GitHub but not on PyPI), pip install through git (pip install git+https://...) will not work. Instead, use the Installation for developers section below.

Installation for developers

Clone this repository recursively to get the header-only C++ dependencies, then generate sources with nox, compile and install awkward-cpp, and finally install awkward as an editable installation:

```bash git clone --recursive https://github.com/scikit-hep/awkward.git cd awkward

nox -s prepare python -m pip install -v ./awkward-cpp python -m pip install -e . ```

Tests can be run in parallel with pytest:

bash python -m pytest -n auto tests

For more details, see CONTRIBUTING.md, or one of the links below.

Documentation, Release notes, Roadmap, Citations

The documentation is on awkward-array.org, including

The Release notes for each version are in the GitHub Releases tab.

The Roadmap, Plans, and Deprecation Schedule are in the GitHub Wiki.

To cite Awkward Array in a paper, see the "Cite this repository" drop-down menu on the top-right of the GitHub front page. The BibTeX is

bibtex @software{Pivarski_Awkward_Array_2018, author = {Pivarski, Jim and Osborne, Ianna and Ifrim, Ioana and Schreiner, Henry and Hollands, Angus and Biswas, Anish and Das, Pratyush and Roy Choudhury, Santam and Smith, Nicholas and Goyal, Manasvi and Fackeldey, Peter and Krommydas, Iason}, doi = {10.5281/zenodo.4341376}, month = {10}, title = {{Awkward Array}}, year = {2018} }

Acknowledgements

Support for this work was provided by NSF cooperative agreement OAC-1836650 (IRIS-HEP 1), PHY-2323298 (IRIS-HEP 2), grant OAC-1450377 (DIANA/HEP), PHY-1520942 and PHY-2121686 (US-CMS LHC Ops), and OAC-2103945 (Awkward Array).

We also thank Erez Shinan and the developers of the Lark standalone parser, which is used to parse type strings as type objects.

Thanks especially to the gracious help of Awkward Array contributors (including the original repository).

Jim Pivarski
Jim Pivarski

💻 📖 🚇 🚧
Ianna Osborne
Ianna Osborne

💻
Pratyush Das
Pratyush Das

💻
Anish Biswas
Anish Biswas

💻
glass-ships
glass-ships

💻 ⚠️
Henry Schreiner
Henry Schreiner

💻 🚇
Nicholas Smith
Nicholas Smith

💻 ⚠️
Lindsey Gray
Lindsey Gray

💻 ⚠️
Ellipse0934
Ellipse0934

⚠️
Dmitry Kalinkin
Dmitry Kalinkin

🚇
Charles Escott
Charles Escott

💻
Mason Proffitt
Mason Proffitt

💻
Michael Hedges
Michael Hedges

💻
Jonas Rembser
Jonas Rembser

💻
Jaydeep Nandi
Jaydeep Nandi

💻
benkrikler
benkrikler

💻
bfis
bfis

💻
Doug Davis
Doug Davis

💻
Joosep Pata
Joosep Pata

🤔
Martin Durant
Martin Durant

🤔
Gordon Watts
Gordon Watts

🤔
Nikolai Hartmann
Nikolai Hartmann

💻
Simon Perkins
Simon Perkins

💻
.hard
.hard

💻 ⚠️
HenryDayHall
HenryDayHall

💻
Angus Hollands
Angus Hollands

⚠️ 💻
ioanaif
ioanaif

💻 ⚠️
Bernhard M. Wiedemann
Bernhard M. Wiedemann

🚧
Matthew Feickert
Matthew Feickert

🚧
Santam Roy Choudhury
Santam Roy Choudhury

⚠️
Jeroen Van Goey
Jeroen Van Goey

📖
Ahmad-AlSubaie
Ahmad-AlSubaie

💻
Manasvi Goyal
Manasvi Goyal

💻
Aryan Roy
Aryan Roy

💻
Saransh
Saransh

💻
Laurits Tani
Laurits Tani

📖
Daniel Savoiu
Daniel Savoiu

💻
Ray Bell
Ray Bell

📖
Andrea Zonca
Andrea Zonca

💻
Chris Burr
Chris Burr

🚇
Zoë Bilodeau
Zoë Bilodeau

💻
Raymond Ehlers
Raymond Ehlers

🚧
Markus Löning
Markus Löning

📖
Kush Kothari
Kush Kothari

💻 ⚠️
Jonas Rübenach
Jonas Rübenach

💻
Jerry Ling
Jerry Ling

📖 💻
Luis Antonio Obis Aparicio
Luis Antonio Obis Aparicio

💻
Topher Cawlfield
Topher Cawlfield

💻
Massimiliano Galli
Massimiliano Galli

💻
Peter Fackeldey
Peter Fackeldey

💻
Andres Rios Tascon
Andres Rios Tascon

💻
maxymnaumchyk
maxymnaumchyk

💻
Thomas A Caswell
Thomas A Caswell

🚧
Bas Nijholt
Bas Nijholt

🚧
Igor Vaiman
Igor Vaiman

💻
Havryliuk Artem
Havryliuk Artem

💻
Iason Krommydas
Iason Krommydas

💻 ⚠️
Nick
Nick

💻
Alexander Puck Neuwirth
Alexander Puck Neuwirth

💻

💻: code, 📖: documentation, 🚇: infrastructure, 🚧: maintenance, ⚠: tests and feedback, 🤔: foundational ideas.

Owner

  • Name: Scikit-HEP Project
  • Login: scikit-hep
  • Kind: organization
  • Email: scikit-hep-forum@googlegroups.com

A community project for High Energy Physics data analysis in Python

Citation (CITATION.cff)

cff-version: 1.2.0
title: "Awkward Array"
message: "If you use this software, please cite it as below."
doi: "10.5281/zenodo.4341376"
date-released: "2018-10-12"
authors:
- family-names: "Pivarski"
  given-names: "Jim"
  affiliation: "Princeton University"
  orcid: "https://orcid.org/0000-0002-6649-343X"
  email: "jpivarski@gmail.com"
- family-names: "Osborne"
  given-names: "Ianna"
  affiliation: "Princeton University"
  orcid: "https://orcid.org/0000-0002-6955-1033"
  email: "iosborne@princeton.edu"
- family-names: "Ifrim"
  given-names: "Ioana"
  affiliation: "Princeton University"
  orcid: "https://orcid.org/0000-0002-6932-1385"
  email: "ii3193@princeton.edu"
- family-names: "Schreiner"
  given-names: "Henry"
  affiliation: "Princeton University"
  orcid: "https://orcid.org/0000-0002-7833-783X"
  email: "henryfs@princeton.edu"
- family-names: "Hollands"
  given-names: "Angus"
  affiliation: "Princeton University"
  orcid: "https://orcid.org/0000-0003-0788-3814"
  email: "goosey15@gmail.com"
- family-names: "Biswas"
  given-names: "Anish"
  affiliation: "Manipal Institute Of Technology"
  orcid: "https://orcid.org/0000-0001-6149-9739"
  email: "anishbiswas271@gmail.com"
- family-names: "Das"
  given-names: "Pratyush"
  affiliation: "Purdue University"
  orcid: "https://orcid.org/0000-0001-8140-0097"
  email: "reikdas@gmail.com"
- family-names: "Roy Choudhury"
  given-names: "Santam"
  affiliation: "National Institute of Technology, Durgapur"
  orcid: "https://orcid.org/0000-0003-0153-9748"
  email: "santamdev404@gmail.com"
- family-names: "Smith"
  given-names: "Nicholas"
  affiliation: "Fermilab"
  orcid: "https://orcid.org/0000-0002-0324-3054"
  email: "nick.smith@cern.ch"
- family-names: "Goyal"
  given-names: "Manasvi"
  affiliation: "Harvard University"
  orcid: "https://orcid.org/0000-0001-6321-7491"
  email: "mg.manasvi@gmail.com"
- family-names: "Fackeldey"
  given-names: "Peter"
  affiliation: "Princeton University"
  orcid: "https://orcid.org/0000-0003-4932-7162"
  email: "pf4572@princeton.edu"
- family-names: "Krommydas"
  given-names: "Iason"
  affiliation: "Rice University"
  orcid: "https://orcid.org/0000-0001-7849-8863"
  email: "ik23@rice.edu"

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 2,447
  • Total Committers: 56
  • Avg Commits per committer: 43.696
  • Development Distribution Score (DDS): 0.607
Past Year
  • Commits: 248
  • Committers: 23
  • Avg Commits per committer: 10.783
  • Development Distribution Score (DDS): 0.835
Top Committers
Name Email Commits
Jim Pivarski j****i 962
Angus Hollands g****5@g****m 605
Ianna Osborne i****e@c****h 166
pre-commit-ci[bot] 6****] 117
dependabot[bot] 4****] 79
Henry Schreiner h****r@c****h 74
ioanaif i****m@g****m 68
allcontributors[bot] 4****] 59
Pratyush Das r****s@g****m 50
Peter Fackeldey f****r@g****m 41
Manasvi Goyal 5****l 33
Iason Krommydas i****m@g****m 21
Anish Biswas a****1@g****m 20
Nicholas Smith n****h@c****h 17
Topher Cawlfield 4****d 12
Anish Biswas 8****f 11
Nikolai Hartmann n****e@p****e 9
Dmitry Kalinkin d****n@g****m 8
Matthew Feickert m****t@c****h 8
Saransh Chopra s****1@g****m 8
Andrea Zonca c****e@a****m 7
Lindsey Gray l****y@g****m 7
Martin Durant m****t 6
maxymnaumchyk 7****k 5
Doug Davis d****s@d****o 4
Chris Burr c****r 4
Anish Biswas 8****n 4
Zoë Bilodeau 7****a 3
Andres Rios Tascon a****s@g****m 3
Anish Biswas a****a@g****m 2
and 26 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 398
  • Total pull requests: 1,107
  • Average time to close issues: 4 months
  • Average time to close pull requests: 10 days
  • Total issue authors: 80
  • Total pull request authors: 35
  • Average comments per issue: 2.06
  • Average comments per pull request: 2.22
  • Merged pull requests: 863
  • Bot issues: 1
  • Bot pull requests: 263
Past Year
  • Issues: 94
  • Pull requests: 459
  • Average time to close issues: 16 days
  • Average time to close pull requests: 5 days
  • Issue authors: 31
  • Pull request authors: 24
  • Average comments per issue: 1.34
  • Average comments per pull request: 1.86
  • Merged pull requests: 344
  • Bot issues: 0
  • Bot pull requests: 111
Top Authors
Issue Authors
  • agoose77 (120)
  • jpivarski (74)
  • ianna (31)
  • lgray (29)
  • ikrommyd (22)
  • alexander-held (7)
  • kmohrman (6)
  • pfackeldey (6)
  • nsmith- (5)
  • martindurant (5)
  • ariostas (4)
  • gipert (3)
  • yimuchen (3)
  • jrueb (3)
  • HealthyPear (3)
Pull Request Authors
  • agoose77 (198)
  • ianna (137)
  • dependabot[bot] (112)
  • pre-commit-ci[bot] (110)
  • jpivarski (106)
  • pfackeldey (102)
  • ikrommyd (65)
  • ManasviGoyal (54)
  • allcontributors[bot] (41)
  • henryiii (39)
  • tcawlfield (22)
  • Saransh-cpp (16)
  • matthewfeickert (15)
  • maxymnaumchyk (11)
  • ariostas (10)
Top Labels
Issue Labels
bug (91) feature (88) bug (unverified) (73) docs (19) cleanup (17) performance (16) installation (10) policy (7) gpu (7) tests (7) autodiff (5) good first issue (5) wontfix (3) one-hour-fix (2) duplicate (2) pr-next-release (2) help wanted (1) dependencies (1) python (1)
Pull Request Labels
dependencies (112) gpu (39) github_actions (30) pr-inactive (5) docs (5) python (4) pr-next-release (4) pr-on-hold (3) policy (2)

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total dependent packages: 18
    (may contain duplicates)
  • Total dependent repositories: 21
    (may contain duplicates)
  • Total versions: 106
conda-forge.org: awkward
  • Versions: 62
  • Dependent Packages: 16
  • Dependent Repositories: 21
Rankings
Dependent packages count: 4.0%
Dependent repos count: 7.9%
Average: 12.0%
Stargazers count: 14.8%
Forks count: 21.3%
Last synced: 4 months ago
conda-forge.org: awkward-numba
  • Versions: 44
  • Dependent Packages: 2
  • Dependent Repositories: 0
Rankings
Stargazers count: 14.6%
Dependent packages count: 19.5%
Forks count: 21.1%
Average: 22.3%
Dependent repos count: 34.0%
Last synced: 4 months ago

Dependencies

requirements-test.txt pypi
  • pytest >=6
  • pytest-cov *
.github/workflows/coverage.yml actions
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/deploy-cpp.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • docker/setup-qemu-action v3.0.0 composite
  • pypa/cibuildwheel v2.15.0 composite
  • pypa/gh-action-pypi-publish v1.8.10 composite
.github/workflows/deploy.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish v1.8.10 composite
  • softprops/action-gh-release v1 composite
.github/workflows/docs-version.yml actions
  • actions/checkout v4 composite
  • aws-actions/configure-aws-credentials v4 composite
.github/workflows/docs.yml actions
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • aws-actions/configure-aws-credentials v4 composite
  • mamba-org/setup-micromamba v1 composite
  • mymindstorm/setup-emsdk v12 composite
.github/workflows/header-only-test.yml actions
  • actions/checkout v4 composite
.github/workflows/lint.yml actions
  • actions/checkout v4 composite
.github/workflows/needs-cpp-release.yml actions
  • actions/checkout v4 composite
.github/workflows/packaging-test.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v3 composite
  • pypa/cibuildwheel v2.15.0 composite
.github/workflows/semantic-pr-title.yml actions
  • amannn/action-semantic-pull-request v5.2.0 composite
.github/workflows/test.yml actions
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
  • jwlawson/actions-setup-cmake v1.14 composite
  • mamba-org/setup-micromamba v1 composite
awkward-cpp/pyproject.toml pypi
  • importlib_resources python_version < "3.9"
  • numpy >=1.18.0
docs/requirements-wasm.txt pypi
  • pydantic <2
  • pyodide-build ==0.23.3
docs/requirements.txt pypi
  • PyYAML *
  • awkward *
  • black *
  • fsspec *
  • h5py *
  • ipyleaflet *
  • jax >=0.2.7
  • jaxlib >=0.1.57
  • jupyterlite ==0.1.0
  • jupyterlite-pyodide-kernel ==0.0.8
  • jupyterlite-sphinx ==0.8.0
  • lark-parser *
  • matplotlib *
  • myst-nb *
  • numba >=0.50.0
  • numexpr *
  • numpy *
  • pandas >=0.24.0
  • pyarrow >=7.0.0
  • pycparser *
  • pydata-sphinx-theme *
  • s3fs *
  • sphinx >=4.5.0,<5.0.0
  • sphinx-copybutton *
  • sphinx-design *
  • sphinx-external-toc *
  • sphinx-sitemap *
  • uproot *
  • uproot3 *
docs/user-guide/requirements.txt pypi
header-only/examples/cython/pyproject.toml pypi
header-only/examples/cython/setup.py pypi
  • awkward >=2.0.0
header-only/examples/pybind11/pyproject.toml pypi
  • awkward >=2.0
  • numpy *
pyproject.toml pypi
  • awkward_cpp ==23
  • importlib_metadata >=4.13.0;python_version < "3.12"
  • numpy >=1.18.0
  • packaging *
  • typing_extensions >=4.1.0; python_version < "3.11"