Defined in awkward.operations.ak_to_layout on line 21.

ak.to_layout(array, *, allow_record=True, allow_other=False, regulararray=True)#
  • array – Array-like data. May be a high level ak.Array, ak.Record (if allow_record), ak.ArrayBuilder, or low-level ak.contents.Content, ak.record.Record (if allow_record), or a supported backend array (NumPy ndarray, CuPy ndarray, JAX DeviceArray), data-less TypeTracer, Arrow object, or an arbitrary Python iterable (for ak.from_iter to convert).

  • allow_record (bool) – If True, allow ak.record.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.

  • regulararray (bool) – Prefer to create ak.contents.RegularArray nodes for regular array objects.

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

This function is usually used to sanitize inputs for other functions; it would rarely be used in a data analysis because ak.contents.Content and ak.record.Record are lower-level than ak.Array.