ak.to_layout — Awkward Array documentation

# ak.to_layout

Defined in awkward.operations.convert on line 1859.

ak.to_layout(array, allow_record=True, allow_other=False, numpytype=(np.number, np.bool_, np.str_, np.bytes_, np.datetime64, np.timedelta64))
  Parameters:

    - array – Data to convert into an `ak.layout.Content` and maybe `ak.layout.Record` and other types.

    - allow_record (bool) – If True, allow `ak.layout.Record` as an output; otherwise, if the output would be a scalar record, raise an error.

    - allow_other (bool) – If True, allow non-Awkward outputs; otherwise, if the output would be another type, raise an error.

    - numpytype (tuple of NumPy types) – Allowed NumPy types in `ak.layout.NumpyArray` outputs.

Converts `array` (many types supported, including all Awkward Arrays and Records) into a `ak.layout.Content` and maybe `ak.layout.Record` and other types.

This function is usually used to sanitize inputs for other functions; it would rarely be used in a data analysis.