ak.to_layout#
Defined in awkward.operations.ak_to_layout on line 31.
- ak.to_layout(array, *, allow_record=True, allow_unknown=False, none_policy='error', use_from_iter=True, primitive_policy='promote', string_policy='as-characters', regulararray=True)#
- Parameters:
array – Array-like data. May be a high level
ak.Array
,ak.Record
(ifallow_record
),ak.ArrayBuilder
, or low-levelak.contents.Content
,ak.record.Record
(ifallow_record
), or a supported backend array (NumPyndarray
, CuPyndarray
, JAX DeviceArray), data-less TypeTracer, Arrow object, or an arbitrary Python iterable (forak.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_unknown (bool) – If True, allow non-Awkward outputs; otherwise, raise an error.
use_from_iter (bool) – If True, allow conversion of iterable inputs to arrays using
ak.from_iter
; otherwise, throw an Exception.none_policy (bool) – (“error”, “pass-through”, “promote”): If “error”, throw an Exception for None inputs; if “pass-through”, return None; otherwise, for “promote” return a length-one array containing the None with unknown type.
primitive_policy ("error", "pass-through", "promote") – If “error”, throw an Exception for scalar inputs; if “pass-through”, return the scalar input; otherwise, for “promote” return a length-one array containing the scalar.
string_policy ("error", "pass-through", "as-characters", "promote") – If “error”, throw an Exception for scalar inputs; if “pass-through”, return the scalar input; ir “as-characters”, return an array of characters; otherwise, for “promote” return a length-one array containing the string.
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
.