ak.ravel#
Defined in awkward.operations.ak_ravel on line 17.
- ak.ravel(array, *, highlevel=True, behavior=None, attrs=None)#
- Parameters:
array – Array-like data (anything
ak.to_layoutrecognizes).highlevel (bool) – If True, return an
ak.Array; otherwise, return a low-levelak.contents.Contentsubclass.behavior (None or dict) – Custom
ak.behaviorfor the output array, if high-level.attrs (None or dict) – Custom attributes for 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.ravelfor 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.flattenwithaxis=Nonefor an equivalent function that eliminates the option type.