arkouda.array_api.manipulation_functions¶
Functions¶
|
Broadcast arrays to a common shape. |
|
Broadcast the array to the specified shape. |
|
Concatenate arrays along an axis. |
|
Create a new array with an additional dimension inserted at the specified axis. |
|
Reverse an array's values along a particular axis or axes. |
|
Move axes of an array to new positions. |
|
Permute the dimensions of an array. |
|
Repeat elements of an array. |
|
Reshape an array to a new shape. |
|
Roll the values in an array by the specified shift(s) along the specified axis or axes. |
|
Remove degenerate (size one) dimensions from an array. |
|
Stack arrays along a new axis. |
|
Tile an array with the specified number of repetitions along each dimension. |
|
Decompose an array along an axis into multiple arrays of the same shape. |
Module Contents¶
- arkouda.array_api.manipulation_functions.broadcast_arrays(*arrays: arkouda.array_api.array_object.Array) List[arkouda.array_api.array_object.Array] [source]¶
Broadcast arrays to a common shape.
Throws a ValueError if a common shape cannot be determined.
- arkouda.array_api.manipulation_functions.broadcast_to(x: arkouda.array_api.array_object.Array, /, shape: Tuple[int, Ellipsis]) arkouda.array_api.array_object.Array [source]¶
Broadcast the array to the specified shape.
See: https://data-apis.org/array-api/latest/API_specification/broadcasting.html for details.
- arkouda.array_api.manipulation_functions.concat(arrays: Tuple[arkouda.array_api.array_object.Array, Ellipsis] | List[arkouda.array_api.array_object.Array], /, *, axis: int | None = 0) arkouda.array_api.array_object.Array [source]¶
Concatenate arrays along an axis.
- arkouda.array_api.manipulation_functions.expand_dims(x: arkouda.array_api.array_object.Array, /, *, axis: int) arkouda.array_api.array_object.Array [source]¶
Create a new array with an additional dimension inserted at the specified axis.
- Parameters:
x (Array) – The array to expand
axis (int) – The axis at which to insert the new (size one) dimension. Must be in the range [-x.ndim-1, x.ndim].
- arkouda.array_api.manipulation_functions.flip(x: arkouda.array_api.array_object.Array, /, *, axis: int | Tuple[int, Ellipsis] | None = None) arkouda.array_api.array_object.Array [source]¶
Reverse an array’s values along a particular axis or axes.
- Parameters:
x (Array) – The array to flip
axis (int or Tuple[int, ...], optional) – The axis or axes along which to flip the array. If None, flip the array along all axes.
- arkouda.array_api.manipulation_functions.moveaxis(x: arkouda.array_api.array_object.Array, source: int | Tuple[int, Ellipsis], destination: int | Tuple[int, Ellipsis], /) arkouda.array_api.array_object.Array [source]¶
Move axes of an array to new positions.
- Parameters:
x (Array) – The array whose axes are to be reordered
source (int or Tuple[int, ...]) – Original positions of the axes to move. Values must be unique and fall within the range [-x.ndim, x.ndim).
destination (int or Tuple[int, ...]) – Destination positions for each of the original axes. Must be the same length as source. Values must be unique and fall within the range [-x.ndim, x.ndim).
- arkouda.array_api.manipulation_functions.permute_dims(x: arkouda.array_api.array_object.Array, /, axes: Tuple[int, Ellipsis]) arkouda.array_api.array_object.Array [source]¶
Permute the dimensions of an array.
- Parameters:
x (Array) – The array whose dimensions are to be permuted
axes (Tuple[int, ...]) – The new order of the dimensions. Must be a permutation of the integers from 0 to x.ndim-1.
- arkouda.array_api.manipulation_functions.repeat(x: arkouda.array_api.array_object.Array, repeats: int | arkouda.array_api.array_object.Array, /, *, axis: int | None = None) arkouda.array_api.array_object.Array [source]¶
Repeat elements of an array.
- Parameters:
x (Array) – The array whose values to repeat
repeats (int or Array) –
- The number of repetitions for each element.
If axis is None, must be an integer, or a 1D array of integers with the same size as x.
If axis is not None, must be an integer, or a 1D array of integers whose size matches the number of elements along the specified axis.
axis (int, optional) – The axis along which to repeat elements. If None, the array is flattened before repeating.
- arkouda.array_api.manipulation_functions.reshape(x: arkouda.array_api.array_object.Array, /, shape: Tuple[int, Ellipsis], *, copy: bool | None = None) arkouda.array_api.array_object.Array [source]¶
Reshape an array to a new shape.
- Parameters:
x (Array) – The array to reshape
shape (Tuple[int, ...]) – The new shape for the array. Must have the same number of elements as the original array.
copy (bool, optional) – Whether to create a copy of the array. WARNING: currently always creates a copy, ignoring the value of this parameter.
- arkouda.array_api.manipulation_functions.roll(x: arkouda.array_api.array_object.Array, /, shift: int | Tuple[int, Ellipsis], *, axis: int | Tuple[int, Ellipsis] | None = None) arkouda.array_api.array_object.Array [source]¶
Roll the values in an array by the specified shift(s) along the specified axis or axes. Elements that roll beyond the last position are re-introduced at the first position.
- Parameters:
x (Array) – The array to roll
shift (int or Tuple[int, ...]) – The number of positions by which to shift each axis. If axis and shift are both tuples, they must have the same length and the i-th element of shift is the number of positions to shift axis[i]. If axis is a tuple and shift is an integer, the same shift is applied to each axis. If axis is None, must be an integer or a one-tuple.
axis (int or Tuple[int, ...], optional) – The axis or axes along which to roll the array. If None, the array is flattened before rolling.
- arkouda.array_api.manipulation_functions.squeeze(x: arkouda.array_api.array_object.Array, /, axis: int | Tuple[int, Ellipsis]) arkouda.array_api.array_object.Array [source]¶
Remove degenerate (size one) dimensions from an array.
- Parameters:
x (Array) – The array to squeeze
axis (int or Tuple[int, ...]) – The axis or axes to squeeze (must have a size of one).
- arkouda.array_api.manipulation_functions.stack(arrays: Tuple[arkouda.array_api.array_object.Array, Ellipsis] | List[arkouda.array_api.array_object.Array], /, *, axis: int = 0) arkouda.array_api.array_object.Array [source]¶
Stack arrays along a new axis.
The resulting array will have one more dimension than the input arrays with a size equal to the number of input arrays.
- arkouda.array_api.manipulation_functions.tile(x: arkouda.array_api.array_object.Array, repetitions: Tuple[int, Ellipsis], /) arkouda.array_api.array_object.Array [source]¶
Tile an array with the specified number of repetitions along each dimension.
- Parameters:
x (Array) – The array to tile
repetitions (Tuple[int, ...]) – The number of repetitions along each dimension. If there are more repetitions than array dimensions, singleton dimensions are prepended to the array to make it match the number of repetitions. If there are more array dimensions than repetitions, ones are prepended to the repetitions tuple to make it’s length match the number of array dimensions.
- arkouda.array_api.manipulation_functions.unstack(x: arkouda.array_api.array_object.Array, /, *, axis: int = 0) Tuple[arkouda.array_api.array_object.Array, Ellipsis] [source]¶
Decompose an array along an axis into multiple arrays of the same shape.
- Parameters:
x (Array) – The array to unstack
axis (int, optional) – The axis along which to unstack the array. The default is 0.