Skip to main content

Manipulate arrays of complex data structures as easily as Numpy.

Project description

awkward-array

Calculations with rectangular, numerical data are simpler and faster in Numpy than traditional for loops. Consider, for instance,

all_r = []
for x, y in zip(all_x, all_y):
    all_r.append(sqrt(x**2 + y**2))

versus

all_r = sqrt(all_x**2 + all_y**2)

Not only is the latter easier to read, it’s hundreds of times faster than the for loop (and provides opportunities for hidden vectorization and parallelization). However, the Numpy abstraction stops at rectangular arrays of numbers or character strings. While it’s possible to put arbitrary Python data in a Numpy array, Numpy’s dtype=object is essentially a fixed-length list: data are not contiguous in memory and operations are not vectorized.

Awkward-array is a pure Python+Numpy library for manipulating complex data structures as you would Numpy arrays. Even if your data structures

  • contain variable-length lists (jagged/ragged),

  • are deeply nested (record structure),

  • have different data types in the same list (heterogeneous),

  • are masked, bit-masked, or index-mapped (nullable),

  • contain cross-references or even cyclic references,

  • need to be Python class instances on demand,

  • are not defined at every point (sparse),

  • are not contiguous in memory,

  • should not be loaded into memory all at once (lazy),

this library can access them as columnar data structures, with the efficiency of Numpy arrays. They may be converted from JSON or Python data, loaded from “awkd” files, HDF5, Parquet, or ROOT files, or they may be views into memory buffers like Arrow.

Installation

Install awkward like any other Python package:

pip install awkward                       # maybe with sudo or --user, or in virtualenv
pip install awkward-numba                 # optional: integration with and optimization by Numba

or install with conda:

conda config --add channels conda-forge   # if you haven't added conda-forge already
conda install awkward
conda install awkward-numba               # optional: integration with and optimization by Numba

The base awkward package requires only Numpy (1.13.1+), but awkward-numba additionally requires Numba.

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

awkward-0.12.1.tar.gz (662.8 kB view details)

Uploaded Source

Built Distribution

awkward-0.12.1-py2.py3-none-any.whl (85.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file awkward-0.12.1.tar.gz.

File metadata

  • Download URL: awkward-0.12.1.tar.gz
  • Upload date:
  • Size: 662.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for awkward-0.12.1.tar.gz
Algorithm Hash digest
SHA256 bed97b8e7e3ad65edbf528bce7a0f8ac38ef4f37e1e574d889c464950dd66ded
MD5 868d5d6075baa3845a06bd6365e9dccc
BLAKE2b-256 8c7cd5db5c2b59d7c1761233f4e7da6f1d0d1ee19d15a848d8a2a8d2600e20bc

See more details on using hashes here.

File details

Details for the file awkward-0.12.1-py2.py3-none-any.whl.

File metadata

  • Download URL: awkward-0.12.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 85.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for awkward-0.12.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 faef8b9dc2c175c3423cf5c494a10de80260803bf816d745facab43bc60e626f
MD5 ef24874ddadbdf61f75db8adc76534af
BLAKE2b-256 dfb2b98383062bb362de183966385de668fb2cceff3444b85872eb86d5e6053f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page