Skip to main content

apply_along_axis

Apply a function to 1-D slices of an array along the given axis. The function is called once for each slice, and the results are assembled into an output array. Supports arrays of any dimensionality. For ND arrays, the function iterates over all combinations of indices on dimensions other than axis.
Returns: NDArray — The result of applying func1d along the specified axis.

apply_over_axes

Apply a function repeatedly over multiple axes. After each application, the result is kept with the reduced axis preserved as a size-1 dimension, so subsequent axes remain valid.
Returns: NDArray — The result of applying func over all specified axes.

shares_memory

Determine whether two arrays share the same underlying data buffer. Returns true only when the arrays definitely reference overlapping memory.
Returns: booleantrue if both arrays share memory.

may_share_memory

Determine whether two arrays might share memory. This is a less strict check than shares_memory — it may return true even when the arrays do not actually overlap, but it never returns false when they do.
Returns: booleantrue if the arrays might share memory.

ndim

Return the number of dimensions of an array.
Returns: number — The number of dimensions (axes).

shape

Return the shape of an array as a number array.
Returns: number[] — The dimensions of the array.

size

Return the total number of elements in an array.
Returns: number — The total number of elements (product of shape dimensions).

geterr

Get the current error handling settings for floating-point operations.
Returns: object — An object with keys divide, over, under, and invalid, each set to one of 'warn', 'raise', 'ignore', or 'print'.

seterr

Set how floating-point errors are handled. Returns the previous settings so you can restore them later.
Returns: FloatErrorState — The previous error handling settings.

item

Get a single scalar element from an array.

tolist

Convert an array to nested JavaScript arrays (or a scalar for 0-D arrays).

tobytes

Return the raw bytes of an array in C-order by default.

byteswap

Swap the byte order of each array element.

view

Create a view of an array (same dtype view currently supported).

tofile

Write an array to a file (Node.js-oriented API; see note in implementation for environment limits).

fill

Fill an array in place with a scalar value.