ak.contents.NumpyArray
----------------------

.. py:module: ak.contents.NumpyArray

Defined in `awkward.contents.numpyarray <https://github.com/scikit-hep/awkward/blob/36da52cfa8846355c390beb6555eac1d31c27c26/src/awkward/contents/numpyarray.py>`__ on `line 62 <https://github.com/scikit-hep/awkward/blob/36da52cfa8846355c390beb6555eac1d31c27c26/src/awkward/contents/numpyarray.py#L62>`__.

.. py: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 <https://arrow.apache.org/docs/format/Columnar.html#fixed-size-primitive-layout>`__.

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

.. code-block:: python


    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:

.. py:attribute:: ak.contents.NumpyArray.data



.. _ak-contents-numpyarray-copy:

.. py:method:: ak.contents.NumpyArray.copy(self, data=UNSET, *, parameters=UNSET, backend=UNSET)



.. _ak-contents-numpyarray-__copy__:

.. py:method:: ak.contents.NumpyArray.__copy__(self)



.. _ak-contents-numpyarray-__deepcopy__:

.. py:method:: ak.contents.NumpyArray.__deepcopy__(self, memo)



.. _ak-contents-numpyarray-simplified:

.. py:method:: ak.contents.NumpyArray.simplified(cls, data, *, parameters=None, backend=None)



.. _ak-contents-numpyarray-shape:

.. py:attribute:: ak.contents.NumpyArray.shape



.. _ak-contents-numpyarray-inner_shape:

.. py:attribute:: ak.contents.NumpyArray.inner_shape



.. _ak-contents-numpyarray-strides:

.. py:attribute:: ak.contents.NumpyArray.strides



.. _ak-contents-numpyarray-dtype:

.. py:attribute:: ak.contents.NumpyArray.dtype



.. _ak-contents-numpyarray-_raw:

.. py:method:: ak.contents.NumpyArray._raw(self, nplike=None)



.. _ak-contents-numpyarray-_form_with_key:

.. py:method:: ak.contents.NumpyArray._form_with_key(self, getkey)



.. _ak-contents-numpyarray-_form_with_key_path:

.. py:method:: ak.contents.NumpyArray._form_with_key_path(self, path)



.. _ak-contents-numpyarray-_to_buffers:

.. py:method:: ak.contents.NumpyArray._to_buffers(self, form, getkey, container, backend, byteorder)



.. _ak-contents-numpyarray-_to_typetracer:

.. py:method:: ak.contents.NumpyArray._to_typetracer(self, forget_length)



.. _ak-contents-numpyarray-_touch_data:

.. py:method:: ak.contents.NumpyArray._touch_data(self, recursive)



.. _ak-contents-numpyarray-_touch_shape:

.. py:method:: ak.contents.NumpyArray._touch_shape(self, recursive)



.. _ak-contents-numpyarray-length:

.. py:attribute:: ak.contents.NumpyArray.length



.. _ak-contents-numpyarray-__repr__:

.. py:method:: ak.contents.NumpyArray.__repr__(self)



.. _ak-contents-numpyarray-_repr:

.. py:method:: ak.contents.NumpyArray._repr(self, indent, pre, post)



.. _ak-contents-numpyarray-to_regulararray:

.. py:method:: ak.contents.NumpyArray.to_RegularArray(self)



.. _ak-contents-numpyarray-maybe_to_numpyarray:

.. py:method:: ak.contents.NumpyArray.maybe_to_NumpyArray(self)



.. _ak-contents-numpyarray-__iter__:

.. py:method:: ak.contents.NumpyArray.__iter__(self)



.. _ak-contents-numpyarray-_getitem_nothing:

.. py:method:: ak.contents.NumpyArray._getitem_nothing(self)



.. _ak-contents-numpyarray-_is_getitem_at_placeholder:

.. py:method:: ak.contents.NumpyArray._is_getitem_at_placeholder(self)



.. _ak-contents-numpyarray-_is_getitem_at_virtual:

.. py:method:: ak.contents.NumpyArray._is_getitem_at_virtual(self)



.. _ak-contents-numpyarray-_getitem_at:

.. py:method:: ak.contents.NumpyArray._getitem_at(self, where)



.. _ak-contents-numpyarray-_getitem_range:

.. py:method:: ak.contents.NumpyArray._getitem_range(self, start, stop)



.. _ak-contents-numpyarray-_getitem_field:

.. py:method:: ak.contents.NumpyArray._getitem_field(self, where, only_fields=())



.. _ak-contents-numpyarray-_getitem_fields:

.. py:method:: ak.contents.NumpyArray._getitem_fields(self, where, only_fields=())



.. _ak-contents-numpyarray-_carry:

.. py:method:: ak.contents.NumpyArray._carry(self, carry, allow_lazy)



.. _ak-contents-numpyarray-_getitem_next_jagged:

.. py:method:: ak.contents.NumpyArray._getitem_next_jagged(self, slicestarts, slicestops, slicecontent, tail)



.. _ak-contents-numpyarray-_getitem_next:

.. py:method:: ak.contents.NumpyArray._getitem_next(self, head, tail, advanced)



.. _ak-contents-numpyarray-_offsets_and_flattened:

.. py:method:: ak.contents.NumpyArray._offsets_and_flattened(self, axis, depth)



.. _ak-contents-numpyarray-_mergeable_next:

.. py:method:: ak.contents.NumpyArray._mergeable_next(self, other, mergebool)



.. _ak-contents-numpyarray-_mergemany:

.. py:method:: ak.contents.NumpyArray._mergemany(self, others)



.. _ak-contents-numpyarray-_fill_none:

.. py:method:: ak.contents.NumpyArray._fill_none(self, value)



.. _ak-contents-numpyarray-_local_index:

.. py:method:: ak.contents.NumpyArray._local_index(self, axis, depth)



.. _ak-contents-numpyarray-to_contiguous:

.. py:method:: ak.contents.NumpyArray.to_contiguous(self)



.. _ak-contents-numpyarray-is_contiguous:

.. py:attribute:: ak.contents.NumpyArray.is_contiguous



.. _ak-contents-numpyarray-_subranges_equal:

.. py:method:: ak.contents.NumpyArray._subranges_equal(self, starts, stops, length, sorted=True)



.. _ak-contents-numpyarray-_as_unique_strings:

.. py:method:: ak.contents.NumpyArray._as_unique_strings(self, offsets)



.. _ak-contents-numpyarray-_numbers_to_type:

.. py:method:: ak.contents.NumpyArray._numbers_to_type(self, name, including_unknown)



.. _ak-contents-numpyarray-_is_unique:

.. py:method:: ak.contents.NumpyArray._is_unique(self, negaxis, starts, parents, outlength)



.. _ak-contents-numpyarray-_unique:

.. py:method:: ak.contents.NumpyArray._unique(self, negaxis, starts, parents, outlength)



.. _ak-contents-numpyarray-_argsort_next:

.. py:method:: ak.contents.NumpyArray._argsort_next(self, negaxis, starts, shifts, parents, outlength, ascending, stable)



.. _ak-contents-numpyarray-_sort_next:

.. py:method:: ak.contents.NumpyArray._sort_next(self, negaxis, starts, parents, outlength, ascending, stable)



.. _ak-contents-numpyarray-_combinations:

.. py:method:: ak.contents.NumpyArray._combinations(self, n, replacement, recordlookup, parameters, axis, depth)



.. _ak-contents-numpyarray-_reduce_next:

.. py:method:: ak.contents.NumpyArray._reduce_next(self, reducer, negaxis, starts, shifts, parents, outlength, mask, keepdims, behavior)



.. _ak-contents-numpyarray-_validity_error:

.. py:method:: ak.contents.NumpyArray._validity_error(self, path)



.. _ak-contents-numpyarray-_pad_none:

.. py:method:: ak.contents.NumpyArray._pad_none(self, target, axis, depth, clip)



.. _ak-contents-numpyarray-_nbytes_part:

.. py:method:: ak.contents.NumpyArray._nbytes_part(self)



.. _ak-contents-numpyarray-_to_arrow:

.. py:method:: ak.contents.NumpyArray._to_arrow(self, pyarrow, mask_node, validbytes, length, options)



.. _ak-contents-numpyarray-_to_cudf:

.. py:method:: ak.contents.NumpyArray._to_cudf(self, cudf, mask, length)



.. _ak-contents-numpyarray-_to_backend_array:

.. py:method:: ak.contents.NumpyArray._to_backend_array(self, allow_missing, backend)



.. _ak-contents-numpyarray-_remove_structure:

.. py:method:: ak.contents.NumpyArray._remove_structure(self, backend, options)



.. _ak-contents-numpyarray-_recursively_apply:

.. py:method:: ak.contents.NumpyArray._recursively_apply(self, action, depth, depth_context, lateral_context, options)



.. _ak-contents-numpyarray-to_packed:

.. py:method:: ak.contents.NumpyArray.to_packed(self, recursive=True)



.. _ak-contents-numpyarray-_to_list:

.. py:method:: ak.contents.NumpyArray._to_list(self, behavior, json_conversions)



.. _ak-contents-numpyarray-_to_backend:

.. py:method:: ak.contents.NumpyArray._to_backend(self, backend)



.. _ak-contents-numpyarray-_materialize:

.. py:method:: ak.contents.NumpyArray._materialize(self)



.. _ak-contents-numpyarray-_is_all_materialized:

.. py:attribute:: ak.contents.NumpyArray._is_all_materialized



.. _ak-contents-numpyarray-_is_any_materialized:

.. py:attribute:: ak.contents.NumpyArray._is_any_materialized



.. _ak-contents-numpyarray-_is_equal_to:

.. py:method:: ak.contents.NumpyArray._is_equal_to(self, other, index_dtype, numpyarray, all_parameters)



.. _ak-contents-numpyarray-_to_regular_primitive:

.. py:method:: ak.contents.NumpyArray._to_regular_primitive(self)