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 Array like any other Python package:

pip install awkward0                      # maybe with sudo or --user, or in virtualenv

The base awkward0 package requires only Numpy (1.13.1+).

Download files

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

Source Distribution

awkward0-0.15.4.tar.gz (122.9 kB view details)

Uploaded Source

Built Distribution

awkward0-0.15.4-py3-none-any.whl (87.6 kB view details)

Uploaded Python 3

File details

Details for the file awkward0-0.15.4.tar.gz.

File metadata

  • Download URL: awkward0-0.15.4.tar.gz
  • Upload date:
  • Size: 122.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for awkward0-0.15.4.tar.gz
Algorithm Hash digest
SHA256 336fc90f88f074e3791983e6d568783e30f8bacdd890be97d9b8762ed579f894
MD5 85c8b750332b4f3b7a4b0f0e8552f3bb
BLAKE2b-256 506bfd87db2c430209a726897f8c56b6d29d1b2aaf633289bc988fb381046e9e

See more details on using hashes here.

File details

Details for the file awkward0-0.15.4-py3-none-any.whl.

File metadata

  • Download URL: awkward0-0.15.4-py3-none-any.whl
  • Upload date:
  • Size: 87.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for awkward0-0.15.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7361d7ac412d1941d892acc673a600c852eae88ab88eda57a7ee3ef538fac7cb
MD5 947819e7ae0b90dab822d753ed51930f
BLAKE2b-256 346f89d805d71d5eead248684dd0ce397ea12a35c33faf6d241fba3428af847b

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