ak.contents.NumpyArray#

Defined in awkward.contents.numpyarray on line 60.

class ak.contents.NumpyArray(self, data, *, parameters=None, backend=None)#

A NumpyArray describes 1-dimensional or rectilinear data using a NumPy np.ndarray, a CuPy cp.ndarray, etc., depending on the backend.

This class is aware of the rectilinear array’s shape and strides, and allows for arbitrary strides, such as Fortran-ordered data. However, many operations require C-contiguous data, so derivatives of Fortran-ordered arrays may not be Fortran-ordered.

Only a subset of dtype values are allowed, and only for your system’s native endianness:

  • bool: boolean, like NumPy’s np.bool_ (considered distinct from integers)

  • int8: signed 8-bit

  • uint8: unsigned 8-bit

  • int16: signed 16-bit

  • uint16: unsigned 16-bit

  • int32: signed 32-bit

  • uint32: unsigned 32-bit

  • int64: signed 64-bit

  • uint64: unsigned 64-bit

  • float16: floating point 16-bit, if your system’s NumPy supports it

  • float32: floating point 32-bit

  • float64: floating point 64-bit

  • float128: floating point 128-bit, if your system’s NumPy supports it

  • complex64: floating complex numbers composed of 32-bit real/imag parts

  • complex128: floating complex numbers composed of 64-bit real/imag parts

  • complex256: floating complex numbers composed of 128-bit real/imag parts, if your system’s NumPy supports it

  • datetime64: date/time, origin is midnight on January 1, 1970, in any units NumPy supports

  • timedelta64: time difference, in any units NumPy supports

If the shape is one-dimensional, a NumpyArray corresponds to an Apache Arrow Primitive array.

To illustrate how the constructor arguments are interpreted, the following is a simplified implementation of __init__, __len__, and __getitem__:

class NumpyArray(Content):
    def __init__(self, data):
        assert isinstance(data, numpy_like_array)
        assert data.dtype in allowed_dtypes
        self.data = data

    def __len__(self):
        return len(self.data)

    def __getitem__(self, where):
        result = self.data[where]
        if isinstance(result, numpy_like_array):
            return NumpyArray(result)
        else:
            return result
ak.contents.NumpyArray.data#
ak.contents.NumpyArray.copy(self, data=UNSET, *, parameters=UNSET, backend=UNSET)#
ak.contents.NumpyArray.__copy__(self)#
ak.contents.NumpyArray.__deepcopy__(self, memo)#
ak.contents.NumpyArray.simplified(cls, data, *, parameters=None, backend=None)#
ak.contents.NumpyArray.shape#
ak.contents.NumpyArray.inner_shape#
ak.contents.NumpyArray.strides#
ak.contents.NumpyArray.dtype#
ak.contents.NumpyArray._raw(self, nplike=None)#
ak.contents.NumpyArray._form_with_key(self, getkey)#
ak.contents.NumpyArray._to_buffers(self, form, getkey, container, backend, byteorder)#
ak.contents.NumpyArray._to_typetracer(self, forget_length)#
ak.contents.NumpyArray._touch_data(self, recursive)#
ak.contents.NumpyArray._touch_shape(self, recursive)#
ak.contents.NumpyArray.length#
ak.contents.NumpyArray.__repr__(self)#
ak.contents.NumpyArray._repr(self, indent, pre, post)#
ak.contents.NumpyArray.to_RegularArray(self)#
ak.contents.NumpyArray.maybe_to_NumpyArray(self)#
ak.contents.NumpyArray.__iter__(self)#
ak.contents.NumpyArray._getitem_nothing(self)#
ak.contents.NumpyArray._is_getitem_at_placeholder(self)#
ak.contents.NumpyArray._getitem_at(self, where)#
ak.contents.NumpyArray._getitem_range(self, start, stop)#
ak.contents.NumpyArray._getitem_field(self, where, only_fields=())#
ak.contents.NumpyArray._getitem_fields(self, where, only_fields=())#
ak.contents.NumpyArray._carry(self, carry, allow_lazy)#
ak.contents.NumpyArray._getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail)#
ak.contents.NumpyArray._getitem_next(self, head, tail, advanced)#
ak.contents.NumpyArray._offsets_and_flattened(self, axis, depth)#
ak.contents.NumpyArray._mergeable_next(self, other, mergebool)#
ak.contents.NumpyArray._mergemany(self, others)#
ak.contents.NumpyArray._fill_none(self, value)#
ak.contents.NumpyArray._local_index(self, axis, depth)#
ak.contents.NumpyArray.to_contiguous(self)#
ak.contents.NumpyArray.is_contiguous#
ak.contents.NumpyArray._subranges_equal(self, starts, stops, length, sorted=True)#
ak.contents.NumpyArray._as_unique_strings(self, offsets)#
ak.contents.NumpyArray._numbers_to_type(self, name, including_unknown)#
ak.contents.NumpyArray._is_unique(self, negaxis, starts, parents, outlength)#
ak.contents.NumpyArray._unique(self, negaxis, starts, parents, outlength)#
ak.contents.NumpyArray._argsort_next(self, negaxis, starts, shifts, parents, outlength, ascending, stable)#
ak.contents.NumpyArray._sort_next(self, negaxis, starts, parents, outlength, ascending, stable)#
ak.contents.NumpyArray._combinations(self, n, replacement, recordlookup, parameters, axis, depth)#
ak.contents.NumpyArray._reduce_next(self, reducer, negaxis, starts, shifts, parents, outlength, mask, keepdims, behavior)#
ak.contents.NumpyArray._validity_error(self, path)#
ak.contents.NumpyArray._pad_none(self, target, axis, depth, clip)#
ak.contents.NumpyArray._nbytes_part(self)#
ak.contents.NumpyArray._to_arrow(self, pyarrow, mask_node, validbytes, length, options)#
ak.contents.NumpyArray._to_backend_array(self, allow_missing, backend)#
ak.contents.NumpyArray._remove_structure(self, backend, options)#
ak.contents.NumpyArray._recursively_apply(self, action, depth, depth_context, lateral_context, options)#
ak.contents.NumpyArray.to_packed(self, recursive=True)#
ak.contents.NumpyArray._to_list(self, behavior, json_conversions)#
ak.contents.NumpyArray._to_backend(self, backend)#
ak.contents.NumpyArray._is_equal_to(self, other, index_dtype, numpyarray, all_parameters)#
ak.contents.NumpyArray._to_regular_primitive(self)#