arkouda.array_api.array_object

Wrapper class around the ndarray object for the array API standard.

The array API standard defines some behaviors differently than ndarray, in particular, type promotion rules are different (the standard has no value-based casting). The standard also specifies a more limited subset of array methods and functionalities than are implemented on ndarray. Since the goal of the array_api namespace is to be a minimal implementation of the array API standard, we need to define a separate wrapper class for the array_api namespace.

The standard compliant class is only a wrapper class. It is not a subclass of ndarray.

Attributes

Classes

Array

n-d array object for the array API namespace.

Functions

implements_numpy(numpy_function)

Register an __array_function__ implementation for MyArray objects.

Module Contents

class arkouda.array_api.array_object.Array[source]

n-d array object for the array API namespace.

See the docstring of np.ndarray for more information.

This is a wrapper around numpy.ndarray that restricts the usage to only those things that are required by the array API namespace. Note, attributes on this object that start with a single underscore are not part of the API specification and should only be used internally. This object should not be constructed directly. Rather, use one of the creation functions, such as asarray().

property T: Array
chunk_info(/) List[List[int]][source]

Get a list of indices indicating how the array is chunked across Locales (compute nodes). Although Arkouda arrays don’t have a notion of chunking, like Dask arrays for example, it can be useful to know how the array is distributed across locales in order to write/read data to/from a chunked format like Zarr.

Returns a nested list of integers, where the outer list corresponds to dimensions, and the inner lists correspond to locales. The value at [d][l] is the global array index where locale l’s local subdomain along the d-th dimension begins.

For example, calling this function on a 100x40 2D array stored across 4 locales could return: [[0, 50], [0, 20]], indicating that the 4 “chunks” start at indices 0 and 50 in the first dimension, and 0 and 20 in the second dimension.

property device: arkouda.array_api._typing.Device
property dtype: arkouda.array_api._typing.Dtype
item()[source]

Get the scalar value from a 0-dimensional array.

Raises a ValueError if the array has more than one element.

property mT: Array
property ndim: int
property shape: Tuple[int, Ellipsis]
property size: int
to_device(device: arkouda.array_api._typing.Device, /, stream: None = None) Array[source]
to_ndarray()[source]

Convert the array to a numpy ndarray

This involves copying the data from the server to the client, and thus will fail if the array is too large (see: maxTransferBytes())

tolist()[source]

Convert the array to a Python list or nested lists

This involves copying the data from the server to the client, and thus will fail if the array is too large (see: maxTransferBytes())

transpose(axes: Tuple[int, Ellipsis] | None = None)[source]

Return a view of the array with the specified axes transposed.

For axes=None, reverse all the dimensions of the array.

arkouda.array_api.array_object.HANDLED_FUNCTIONS: Dict[str, Callable]
arkouda.array_api.array_object.implements_numpy(numpy_function)[source]

Register an __array_function__ implementation for MyArray objects.