ak.types.Type¶
Superclass of type nodes that describe a high-level data type (see ak.type and ak.Array.layout).
Types are rendered as Datashape strings, whenever possible. In some cases, they have more information than this specification can express, so we extend the Datashape language in natural ways.
The type subclasses are listed below.
ak.types.ArrayType: type of a high-level ak.Array, which includes the length of the array (and hence is not composable with other types).
ak.types.UnknownType: a type that is not known, for example in ak.layout.EmptyArray.
ak.types.PrimitiveType: numbers and booleans.
ak.types.RegularType: nested lists, each with the same length.
ak.types.ListType: nested lists with unconstrained lengths.
ak.types.RecordType: records or tuples.
ak.types.OptionType: data that might be missing (None in Python).
ak.types.UnionType: heterogeneous data; one of several types.
All ak.types.Type instances have the following properties and methods in common.
ak.types.Type.__repr__¶
-
ak.types.Type.
__repr__
()¶
String representation of the type, mostly following the Datashape grammar.
ak.types.Type.empty¶
-
ak.types.Type.
empty
()¶
Creates an empty ak.layout.Content array with this type.
ak.types.Type.fieldindex¶
-
ak.types.Type.
fieldindex
(key)¶
Returns the index position of a key
if the type contains
ak.types.RecordType and key
is in the record.
ak.types.Type.haskey¶
-
ak.types.Type.
haskey
(key)¶
Returns True if the type contains ak.types.RecordType and key
is
in the record; False otherwise.
ak.types.Type.key¶
-
ak.types.Type.
key
(fieldindex)¶
Returns the key
name at a given index position in the record if the
type contains ak.types.RecordType with more than fieldindex
fields.
ak.types.Type.keys¶
-
ak.types.Type.
keys
()¶
Returns a list of keys in the record if the type contains ak.types.RecordType.
ak.types.Type.setparameter¶
-
ak.types.Type.
setparameter
(key, value)¶
Sets a parameter.
Do not use this method! Mutable parameters are deprecated.
ak.types.Type.numfields¶
-
ak.types.Type.
numfields
¶
Returns the number of fields in the record if this type contains a ak.types.RecordType.
ak.types.Type.parameters¶
-
ak.types.Type.
parameters
¶
Returns the parameters associated with this type.
ak.types.Type.typestr¶
-
ak.types.Type.
typestr
¶
Returns the custom type string if overridden with ak.behavior.
See Custom type names.