Last updated:
0 purchases
awkward0 0.15.5
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+).
Recommended packages:
pyarrow to view Arrow and Parquet data as Awkward Arrays
h5py to read and write Awkward Arrays in HDF5 files
Pandas as an alternative view
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.