ak.from_numpy#
Defined in awkward.operations.ak_from_numpy on line 12.
- ak.from_numpy(array, *, regulararray=False, recordarray=True, highlevel=True, behavior=None, primitive_policy='error', attrs=None)#
- Parameters:
array (np.ndarray) – The NumPy array to convert into an Awkward Array. This array can be a np.ma.MaskedArray.
regulararray (bool) – If True and the array is multidimensional, the dimensions are represented by nested
ak.contents.RegularArraynodes; if False and the array is multidimensional, the dimensions are represented by a multivaluedak.contents.NumpyArray.shape. If the array is one-dimensional, this has no effect.recordarray (bool) – If True and the array is a NumPy structured array (dtype.names is not None), the fields are represented by an
ak.contents.RecordArray; if False and the array is a structured array, the structure is left in theak.contents.NumpyArrayformat, which some functions do not recognize.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.
Converts a NumPy array into an Awkward Array.
The resulting layout can only involve the following ak.contents.Content types:
ak.contents.ByteMaskedArrayorak.contents.UnmaskedArrayif thearrayis an np.ma.MaskedArray.ak.contents.RegularArrayifregulararray=True.ak.contents.RecordArrayifrecordarray=True.
See also ak.to_numpy and ak.from_cupy.