- ak._v2.ak_ravel.ravel(array, highlevel=True, behavior=None)¶
array – Data containing nested lists to flatten
highlevel (bool) – If True, return an
ak.Array; otherwise, return a low-level
behavior (None or dict) – Custom
ak.behaviorfor the output array, if high-level.
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 doubly nested
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
>>> print(ak.ravel(array)) [1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9]
Missing values are eliminated by flattening: there is no distinction between an empty list and a value of None at the level of flattening.