ak.ravel#

Defined in awkward.operations.ak_ravel on line 13.

ak.ravel(array, *, highlevel=True, behavior=None)#
Parameters

Returns an array with all level of nesting removed by erasing the boundaries between consecutive lists.

This is the equivalent of NumPy’s np.ravel for Awkward Arrays.

Consider the following:

>>> array = ak.Array([[[1.1, 2.2, 3.3],
...                    [],
...                    [4.4, 5.5],
...                    [6.6]],
...                   [],
...                   [[7.7],
...                    [8.8, 9.9]
...                   ]])

Ravelling the array produces a flat array

>>> ak.ravel(array).show()
[1.1,
 2.2,
 3.3,
 4.4,
 5.5,
 6.6,
 7.7,
 8.8,
 9.9]

Missing values are not eliminated by flattening. See ak.flatten with axis=None for an equivalent function that eliminates the option type.