> ## Documentation Index
> Fetch the complete documentation index at: https://numpyts.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# NDArray Methods

> All 100+ chainable instance methods on NDArray, grouped by category.

# NDArray Methods

The `NDArray` class (from the default `numpy-ts` entry point) provides chainable instance methods that delegate to the corresponding standalone functions. Each method below calls its standalone equivalent under the hood.

```typescript theme={null}
import * as np from 'numpy-ts';

// Method chaining
const result = np.arange(12)
  .reshape(3, 4)
  .multiply(2)
  .sum(0);

// Equivalent standalone calls
const a = np.arange(12);
const b = np.reshape(a, [3, 4]);
const c = np.multiply(b, 2);
const d = np.sum(c, 0);
```

> [!NOTE]
>
> These methods are only available on `NDArray` (the full entry point). `NDArrayCore` from `numpy-ts/core` does not include them. See the [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md) page for core methods available on both classes.

***

## Arithmetic methods

### add

```typescript theme={null}
add(other: NDArray | number): NDArray
```

Element-wise addition. See [add](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### subtract

```typescript theme={null}
subtract(other: NDArray | number): NDArray
```

Element-wise subtraction. See [subtract](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### multiply

```typescript theme={null}
multiply(other: NDArray | number): NDArray
```

Element-wise multiplication. See [multiply](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### divide

```typescript theme={null}
divide(other: NDArray | number): NDArray
```

Element-wise division. See [divide](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### floor\_divide

```typescript theme={null}
floor_divide(other: NDArray | number): NDArray
```

Element-wise floor division. See [floor\_divide](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### mod

```typescript theme={null}
mod(other: NDArray | number): NDArray
```

Element-wise modulo. See [mod](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### remainder

```typescript theme={null}
remainder(divisor: NDArray | number): NDArray
```

Element-wise remainder (same as `mod`). See [remainder](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### fmod

```typescript theme={null}
fmod(divisor: NDArray | number): NDArray
```

Element-wise C-style remainder. See [fmod](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### power

```typescript theme={null}
power(exponent: NDArray | number): NDArray
```

Raise elements to the given power. See [power](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### negative

```typescript theme={null}
negative(): NDArray
```

Element-wise numerical negation (`-x`). See [negative](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### positive

```typescript theme={null}
positive(): NDArray
```

Element-wise numerical positive (`+x`). Returns a copy. See [positive](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### absolute

```typescript theme={null}
absolute(): NDArray
```

Element-wise absolute value. See [absolute](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### reciprocal

```typescript theme={null}
reciprocal(): NDArray
```

Element-wise reciprocal (`1/x`). See [reciprocal](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### square

```typescript theme={null}
square(): NDArray
```

Element-wise square (`x**2`). See [square](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### sqrt

```typescript theme={null}
sqrt(): NDArray
```

Element-wise square root. See [sqrt](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### cbrt

```typescript theme={null}
cbrt(): NDArray
```

Element-wise cube root. See [cbrt](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### fabs

```typescript theme={null}
fabs(): NDArray
```

Element-wise absolute value (always returns float). See [fabs](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### sign

```typescript theme={null}
sign(): NDArray
```

Element-wise sign indication (-1, 0, or 1). See [sign](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### heaviside

```typescript theme={null}
heaviside(x2: NDArray | number): NDArray
```

Heaviside step function. See [heaviside](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

### divmod

```typescript theme={null}
divmod(divisor: NDArray | number): [NDArray, NDArray]
```

Returns both floor quotient and remainder. See [divmod](https://numpyts.dev/v1.7.x/api/math/arithmetic.md).

***

## Exponential and logarithmic methods

### exp

```typescript theme={null}
exp(): NDArray
```

Natural exponential (`e^x`). See [exp](https://numpyts.dev/v1.7.x/api/math/exponential.md).

### exp2

```typescript theme={null}
exp2(): NDArray
```

Base-2 exponential (`2^x`). See [exp2](https://numpyts.dev/v1.7.x/api/math/exponential.md).

### expm1

```typescript theme={null}
expm1(): NDArray
```

`e^x - 1`, accurate for small x. See [expm1](https://numpyts.dev/v1.7.x/api/math/exponential.md).

### log

```typescript theme={null}
log(): NDArray
```

Natural logarithm. See [log](https://numpyts.dev/v1.7.x/api/math/exponential.md).

### log2

```typescript theme={null}
log2(): NDArray
```

Base-2 logarithm. See [log2](https://numpyts.dev/v1.7.x/api/math/exponential.md).

### log10

```typescript theme={null}
log10(): NDArray
```

Base-10 logarithm. See [log10](https://numpyts.dev/v1.7.x/api/math/exponential.md).

### log1p

```typescript theme={null}
log1p(): NDArray
```

`ln(1 + x)`, accurate for small x. See [log1p](https://numpyts.dev/v1.7.x/api/math/exponential.md).

### logaddexp

```typescript theme={null}
logaddexp(x2: NDArray | number): NDArray
```

`log(exp(x1) + exp(x2))`, numerically stable. See [logaddexp](https://numpyts.dev/v1.7.x/api/math/exponential.md).

### logaddexp2

```typescript theme={null}
logaddexp2(x2: NDArray | number): NDArray
```

`log2(2^x1 + 2^x2)`, numerically stable. See [logaddexp2](https://numpyts.dev/v1.7.x/api/math/exponential.md).

***

## Trigonometric methods

### sin

```typescript theme={null}
sin(): NDArray
```

Sine (radians). See [sin](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### cos

```typescript theme={null}
cos(): NDArray
```

Cosine (radians). See [cos](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### tan

```typescript theme={null}
tan(): NDArray
```

Tangent (radians). See [tan](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### arcsin

```typescript theme={null}
arcsin(): NDArray
```

Inverse sine. See [arcsin](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### arccos

```typescript theme={null}
arccos(): NDArray
```

Inverse cosine. See [arccos](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### arctan

```typescript theme={null}
arctan(): NDArray
```

Inverse tangent. See [arctan](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### arctan2

```typescript theme={null}
arctan2(other: NDArray | number): NDArray
```

Element-wise arc tangent of `this/other`, choosing the correct quadrant. See [arctan2](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### hypot

```typescript theme={null}
hypot(other: NDArray | number): NDArray
```

Hypotenuse given two right-triangle legs. See [hypot](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### degrees

```typescript theme={null}
degrees(): NDArray
```

Convert radians to degrees. See [degrees](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

### radians

```typescript theme={null}
radians(): NDArray
```

Convert degrees to radians. See [radians](https://numpyts.dev/v1.7.x/api/math/trigonometric.md).

***

## Hyperbolic methods

### sinh

```typescript theme={null}
sinh(): NDArray
```

Hyperbolic sine. See [sinh](https://numpyts.dev/v1.7.x/api/math/hyperbolic.md).

### cosh

```typescript theme={null}
cosh(): NDArray
```

Hyperbolic cosine. See [cosh](https://numpyts.dev/v1.7.x/api/math/hyperbolic.md).

### tanh

```typescript theme={null}
tanh(): NDArray
```

Hyperbolic tangent. See [tanh](https://numpyts.dev/v1.7.x/api/math/hyperbolic.md).

### arcsinh

```typescript theme={null}
arcsinh(): NDArray
```

Inverse hyperbolic sine. See [arcsinh](https://numpyts.dev/v1.7.x/api/math/hyperbolic.md).

### arccosh

```typescript theme={null}
arccosh(): NDArray
```

Inverse hyperbolic cosine. See [arccosh](https://numpyts.dev/v1.7.x/api/math/hyperbolic.md).

### arctanh

```typescript theme={null}
arctanh(): NDArray
```

Inverse hyperbolic tangent. See [arctanh](https://numpyts.dev/v1.7.x/api/math/hyperbolic.md).

***

## Rounding methods

### ceil

```typescript theme={null}
ceil(): NDArray
```

Ceiling of each element. See [ceil](https://numpyts.dev/v1.7.x/api/math/rounding.md).

### floor

```typescript theme={null}
floor(): NDArray
```

Floor of each element. See [floor](https://numpyts.dev/v1.7.x/api/math/rounding.md).

### fix

```typescript theme={null}
fix(): NDArray
```

Round towards zero. See [fix](https://numpyts.dev/v1.7.x/api/math/rounding.md).

### rint

```typescript theme={null}
rint(): NDArray
```

Round to nearest integer. See [rint](https://numpyts.dev/v1.7.x/api/math/rounding.md).

### trunc

```typescript theme={null}
trunc(): NDArray
```

Truncate to integer part. See [trunc](https://numpyts.dev/v1.7.x/api/math/rounding.md).

### around

```typescript theme={null}
around(decimals?: number): NDArray
```

Round to the given number of decimals (default: 0). See [around](https://numpyts.dev/v1.7.x/api/math/rounding.md).

### round

```typescript theme={null}
round(decimals?: number): NDArray
```

Alias for `around`. See [around](https://numpyts.dev/v1.7.x/api/math/rounding.md).

### clip

```typescript theme={null}
clip(a_min: number | NDArray | null, a_max: number | NDArray | null): NDArray
```

Clip values to `[a_min, a_max]`. Pass `null` for no bound on either side. See [clip](https://numpyts.dev/v1.7.x/api/math/other-math.md).

***

## Comparison methods

### equal

```typescript theme={null}
equal(other: NDArray | number): NDArray
```

Element-wise equality. Returns boolean array. See [equal](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### not\_equal

```typescript theme={null}
not_equal(other: NDArray | number): NDArray
```

Element-wise inequality. Returns boolean array. See [not\_equal](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### greater

```typescript theme={null}
greater(other: NDArray | number): NDArray
```

Element-wise greater than. Returns boolean array. See [greater](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### greater\_equal

```typescript theme={null}
greater_equal(other: NDArray | number): NDArray
```

Element-wise greater than or equal. Returns boolean array. See [greater\_equal](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### less

```typescript theme={null}
less(other: NDArray | number): NDArray
```

Element-wise less than. Returns boolean array. See [less](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### less\_equal

```typescript theme={null}
less_equal(other: NDArray | number): NDArray
```

Element-wise less than or equal. Returns boolean array. See [less\_equal](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### allclose

```typescript theme={null}
allclose(other: NDArray | number, rtol?: number, atol?: number): boolean
```

Returns `true` if all elements are equal within tolerance. Default `rtol=1e-5`, `atol=1e-8`. See [allclose](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### isclose

```typescript theme={null}
isclose(other: NDArray | number, rtol?: number, atol?: number): NDArray
```

Element-wise comparison within tolerance. Returns boolean array. See [isclose](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### isnan

```typescript theme={null}
isnan(): NDArray
```

Test element-wise for NaN. Returns boolean array. See [isnan](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### isinf

```typescript theme={null}
isinf(): NDArray
```

Test element-wise for infinity. Returns boolean array. See [isinf](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### isfinite

```typescript theme={null}
isfinite(): NDArray
```

Test element-wise for finiteness. Returns boolean array. See [isfinite](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

### isnat

```typescript theme={null}
isnat(): NDArray
```

Test element-wise for NaT (Not a Time). Always returns `false` (no datetime support). See [isnat](https://numpyts.dev/v1.7.x/api/logic/comparison.md).

***

## Logic methods

### logical\_and

```typescript theme={null}
logical_and(other: NDArray | number): NDArray
```

Element-wise logical AND. Returns boolean array. See [logical\_and](https://numpyts.dev/v1.7.x/api/logic/logical-ops.md).

### logical\_or

```typescript theme={null}
logical_or(other: NDArray | number): NDArray
```

Element-wise logical OR. Returns boolean array. See [logical\_or](https://numpyts.dev/v1.7.x/api/logic/logical-ops.md).

### logical\_not

```typescript theme={null}
logical_not(): NDArray
```

Element-wise logical NOT. Returns boolean array. See [logical\_not](https://numpyts.dev/v1.7.x/api/logic/logical-ops.md).

### logical\_xor

```typescript theme={null}
logical_xor(other: NDArray | number): NDArray
```

Element-wise logical XOR. Returns boolean array. See [logical\_xor](https://numpyts.dev/v1.7.x/api/logic/logical-ops.md).

### invert

```typescript theme={null}
invert(): NDArray
```

Bitwise NOT (alias for `bitwise_not`). See [invert](https://numpyts.dev/v1.7.x/api/bitwise/bitwise-ops.md).

### bitwise\_and

```typescript theme={null}
bitwise_and(other: NDArray | number): NDArray
```

Element-wise bitwise AND. Requires integer dtype. See [bitwise\_and](https://numpyts.dev/v1.7.x/api/bitwise/bitwise-ops.md).

### bitwise\_or

```typescript theme={null}
bitwise_or(other: NDArray | number): NDArray
```

Element-wise bitwise OR. Requires integer dtype. See [bitwise\_or](https://numpyts.dev/v1.7.x/api/bitwise/bitwise-ops.md).

### bitwise\_xor

```typescript theme={null}
bitwise_xor(other: NDArray | number): NDArray
```

Element-wise bitwise XOR. Requires integer dtype. See [bitwise\_xor](https://numpyts.dev/v1.7.x/api/bitwise/bitwise-ops.md).

### bitwise\_not

```typescript theme={null}
bitwise_not(): NDArray
```

Element-wise bitwise NOT. Requires integer dtype. See [bitwise\_not](https://numpyts.dev/v1.7.x/api/bitwise/bitwise-ops.md).

### left\_shift

```typescript theme={null}
left_shift(shift: NDArray | number): NDArray
```

Element-wise left bit shift. See [left\_shift](https://numpyts.dev/v1.7.x/api/bitwise/bitwise-ops.md).

### right\_shift

```typescript theme={null}
right_shift(shift: NDArray | number): NDArray
```

Element-wise right bit shift. See [right\_shift](https://numpyts.dev/v1.7.x/api/bitwise/bitwise-ops.md).

### copysign

```typescript theme={null}
copysign(x2: NDArray | number): NDArray
```

Change the sign of `this` to that of `x2`, element-wise. See [copysign](https://numpyts.dev/v1.7.x/api/logic/logical-ops.md).

### signbit

```typescript theme={null}
signbit(): NDArray
```

Returns `true` where the sign bit is set (negative). See [signbit](https://numpyts.dev/v1.7.x/api/logic/logical-ops.md).

### nextafter

```typescript theme={null}
nextafter(x2: NDArray | number): NDArray
```

Return the next floating-point value after `this` towards `x2`. See [nextafter](https://numpyts.dev/v1.7.x/api/logic/logical-ops.md).

### spacing

```typescript theme={null}
spacing(): NDArray
```

Return the distance between each element and the nearest adjacent number. See [spacing](https://numpyts.dev/v1.7.x/api/logic/logical-ops.md).

***

## Reduction methods

### sum

```typescript theme={null}
sum(axis?: number, keepdims?: boolean): NDArray | number | bigint | Complex
```

Sum of elements along an axis. Returns a scalar when axis is `undefined`. See [sum](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### prod

```typescript theme={null}
prod(axis?: number, keepdims?: boolean): NDArray | number | bigint | Complex
```

Product of elements along an axis. See [prod](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### mean

```typescript theme={null}
mean(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Arithmetic mean along an axis. See [mean](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### std

```typescript theme={null}
std(axis?: number, ddof?: number, keepdims?: boolean): NDArray | number
```

Standard deviation along an axis. `ddof` defaults to 0. See [std](https://numpyts.dev/v1.7.x/api/reductions/statistics.md).

### var

```typescript theme={null}
var(axis?: number, ddof?: number, keepdims?: boolean): NDArray | number
```

Variance along an axis. `ddof` defaults to 0. See [var](https://numpyts.dev/v1.7.x/api/reductions/statistics.md).

### min

```typescript theme={null}
min(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Minimum value along an axis. See [min](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### max

```typescript theme={null}
max(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Maximum value along an axis. See [max](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### argmin

```typescript theme={null}
argmin(axis?: number): NDArray | number
```

Index of the minimum value along an axis. See [argmin](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### argmax

```typescript theme={null}
argmax(axis?: number): NDArray | number
```

Index of the maximum value along an axis. See [argmax](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### all

```typescript theme={null}
all(axis?: number, keepdims?: boolean): NDArray | boolean
```

Test whether all elements evaluate to `true`. See [all](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### any

```typescript theme={null}
any(axis?: number, keepdims?: boolean): NDArray | boolean
```

Test whether any element evaluates to `true`. See [any](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### ptp

```typescript theme={null}
ptp(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Peak-to-peak (maximum minus minimum) along an axis. See [ptp](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### median

```typescript theme={null}
median(axis?: number, keepdims?: boolean): NDArray | number
```

Median along an axis. See [median](https://numpyts.dev/v1.7.x/api/reductions/statistics.md).

### percentile

```typescript theme={null}
percentile(q: number, axis?: number, keepdims?: boolean): NDArray | number
```

Compute the q-th percentile (0--100). See [percentile](https://numpyts.dev/v1.7.x/api/reductions/search-count.md).

### quantile

```typescript theme={null}
quantile(q: number, axis?: number, keepdims?: boolean): NDArray | number
```

Compute the q-th quantile (0--1). See [quantile](https://numpyts.dev/v1.7.x/api/reductions/search-count.md).

### average

```typescript theme={null}
average(weights?: NDArray, axis?: number): NDArray | number | Complex
```

Weighted average along an axis. See [average](https://numpyts.dev/v1.7.x/api/reductions/statistics.md).

### cumsum

```typescript theme={null}
cumsum(axis?: number): NDArray
```

Cumulative sum along an axis. See [cumsum](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### cumprod

```typescript theme={null}
cumprod(axis?: number): NDArray
```

Cumulative product along an axis. See [cumprod](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### diff

```typescript theme={null}
diff(n?: number, axis?: number): NDArray
```

Calculate the n-th discrete difference along an axis. See [diff](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nansum

```typescript theme={null}
nansum(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Sum treating NaNs as zero. See [nansum](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nanprod

```typescript theme={null}
nanprod(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Product treating NaNs as one. See [nanprod](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nanmean

```typescript theme={null}
nanmean(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Mean ignoring NaNs. See [nanmean](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nanstd

```typescript theme={null}
nanstd(axis?: number, ddof?: number, keepdims?: boolean): NDArray | number
```

Standard deviation ignoring NaNs. See [nanstd](https://numpyts.dev/v1.7.x/api/reductions/statistics.md).

### nanvar

```typescript theme={null}
nanvar(axis?: number, ddof?: number, keepdims?: boolean): NDArray | number
```

Variance ignoring NaNs. See [nanvar](https://numpyts.dev/v1.7.x/api/reductions/statistics.md).

### nanmin

```typescript theme={null}
nanmin(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Minimum ignoring NaNs. See [nanmin](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nanmax

```typescript theme={null}
nanmax(axis?: number, keepdims?: boolean): NDArray | number | Complex
```

Maximum ignoring NaNs. See [nanmax](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nanargmin

```typescript theme={null}
nanargmin(axis?: number): NDArray | number
```

Index of minimum ignoring NaNs. See [nanargmin](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nanargmax

```typescript theme={null}
nanargmax(axis?: number): NDArray | number
```

Index of maximum ignoring NaNs. See [nanargmax](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nanmedian

```typescript theme={null}
nanmedian(axis?: number, keepdims?: boolean): NDArray | number
```

Median ignoring NaNs. See [nanmedian](https://numpyts.dev/v1.7.x/api/reductions/statistics.md).

### nancumsum

```typescript theme={null}
nancumsum(axis?: number): NDArray
```

Cumulative sum treating NaNs as zero. See [nancumsum](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nancumprod

```typescript theme={null}
nancumprod(axis?: number): NDArray
```

Cumulative product treating NaNs as one. See [nancumprod](https://numpyts.dev/v1.7.x/api/reductions/basic.md).

### nanpercentile

```typescript theme={null}
nanpercentile(q: number, axis?: number, keepdims?: boolean): NDArray | number
```

Percentile ignoring NaNs. See [nanpercentile](https://numpyts.dev/v1.7.x/api/reductions/nan-safe.md).

### nanquantile

```typescript theme={null}
nanquantile(q: number, axis?: number, keepdims?: boolean): NDArray | number
```

Quantile ignoring NaNs. See [nanquantile](https://numpyts.dev/v1.7.x/api/reductions/nan-safe.md).

***

## Shape methods

### reshape

```typescript theme={null}
reshape(...shape: number[]): NDArray
```

Return a new array with the given shape. Use `-1` for one inferred dimension. See [reshape](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### flatten

```typescript theme={null}
flatten(): NDArray
```

Return a flattened copy (always 1D). See [flatten](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### ravel

```typescript theme={null}
ravel(): NDArray
```

Return a flattened array. Returns a view when possible, otherwise a copy. See [ravel](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### squeeze

```typescript theme={null}
squeeze(axis?: number): NDArray
```

Remove axes of length one. See [squeeze](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### expand\_dims

```typescript theme={null}
expand_dims(axis: number): NDArray
```

Insert a new axis of length one at the given position. See [expand\_dims](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### transpose

```typescript theme={null}
transpose(axes?: number[]): NDArray
```

Permute the dimensions. With no arguments, reverses all axes. See [transpose](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### swapaxes

```typescript theme={null}
swapaxes(axis1: number, axis2: number): NDArray
```

Interchange two axes. See [swapaxes](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### moveaxis

```typescript theme={null}
moveaxis(source: number | number[], destination: number | number[]): NDArray
```

Move axes to new positions. See [moveaxis](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### T

```typescript theme={null}
get T(): NDArray
```

Transpose property (no parentheses). Returns a view with reversed axes. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#t).

***

## Linear algebra methods

### dot

```typescript theme={null}
dot(other: NDArray): NDArray | number | bigint | Complex
```

Dot product following NumPy semantics (inner product for 1D, matrix multiply for 2D). See [dot](https://numpyts.dev/v1.7.x/api/linalg/products.md).

### matmul

```typescript theme={null}
matmul(other: NDArray): NDArray
```

Matrix multiplication (`@` operator equivalent). See [matmul](https://numpyts.dev/v1.7.x/api/linalg/products.md).

### inner

```typescript theme={null}
inner(other: NDArray): NDArray | number | bigint | Complex
```

Inner product (contracts over last axes of both arrays). See [inner](https://numpyts.dev/v1.7.x/api/linalg/products.md).

### outer

```typescript theme={null}
outer(other: NDArray): NDArray
```

Outer product (flattens inputs, computes `a[i] * b[j]`). See [outer](https://numpyts.dev/v1.7.x/api/linalg/products.md).

### tensordot

```typescript theme={null}
tensordot(other: NDArray, axes?: number | [number[], number[]]): NDArray | number | bigint | Complex
```

Tensor dot product along specified axes. Default contracts 2 axes. See [tensordot](https://numpyts.dev/v1.7.x/api/linalg/products.md).

### trace

```typescript theme={null}
trace(): number | bigint | Complex
```

Sum of diagonal elements. See [trace](https://numpyts.dev/v1.7.x/api/linalg/products.md).

### diagonal

```typescript theme={null}
diagonal(offset?: number, axis1?: number, axis2?: number): NDArray
```

Return specified diagonals. See [diagonal](https://numpyts.dev/v1.7.x/api/linalg/products.md).

***

## Sorting and searching methods

### sort

```typescript theme={null}
sort(axis?: number): NDArray
```

Return a sorted copy. Default sorts along the last axis. See [sort](https://numpyts.dev/v1.7.x/api/sorting/sort.md).

### argsort

```typescript theme={null}
argsort(axis?: number): NDArray
```

Return indices that would sort the array. See [argsort](https://numpyts.dev/v1.7.x/api/sorting/sort.md).

### partition

```typescript theme={null}
partition(kth: number, axis?: number): NDArray
```

Partially sort so that the element at `kth` position is in its final sorted position. See [partition](https://numpyts.dev/v1.7.x/api/sorting/sort.md).

### argpartition

```typescript theme={null}
argpartition(kth: number, axis?: number): NDArray
```

Return indices that would partition the array. See [argpartition](https://numpyts.dev/v1.7.x/api/sorting/sort.md).

### searchsorted

```typescript theme={null}
searchsorted(v: NDArray, side?: 'left' | 'right'): NDArray
```

Find indices where elements should be inserted to maintain order. See [searchsorted](https://numpyts.dev/v1.7.x/api/sorting/search.md).

### nonzero

```typescript theme={null}
nonzero(): NDArray[]
```

Return indices of non-zero elements, one array per dimension. See [nonzero](https://numpyts.dev/v1.7.x/api/sorting/search.md).

### argwhere

```typescript theme={null}
argwhere(): NDArray
```

Find indices of non-zero elements, returned as a 2D array of shape `(N, ndim)`. See [argwhere](https://numpyts.dev/v1.7.x/api/sorting/search.md).

***

## Indexing methods

### take

```typescript theme={null}
take(indices: ArrayLike, axis?: number): NDArray
```

Take elements along an axis. `indices` accepts NDArrays of any rank, nested `number[]`/`number[][]`/`number[][][]`, or a scalar; the output preserves the shape of `indices` (a scalar index reduces rank by one). See [take](https://numpyts.dev/v1.7.x/api/indexing/advanced-indexing.md).

### put

```typescript theme={null}
put(indices: number[], values: NDArray | number | bigint): void
```

Set values at flat indices (in-place). See [put](https://numpyts.dev/v1.7.x/api/indexing/advanced-indexing.md).

### choose

```typescript theme={null}
choose(choices: NDArray[]): NDArray
```

Construct an array by choosing from a list of arrays using `this` as the index. See [choose](https://numpyts.dev/v1.7.x/api/indexing/advanced-indexing.md).

### compress

```typescript theme={null}
compress(condition: NDArray | boolean[], axis?: number): NDArray
```

Return selected slices along an axis where `condition` is `true`. See [compress](https://numpyts.dev/v1.7.x/api/indexing/advanced-indexing.md).

### repeat

```typescript theme={null}
repeat(repeats: number | number[], axis?: number): NDArray
```

Repeat elements of the array. See [repeat](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### resize

```typescript theme={null}
resize(newShape: number[]): NDArray
```

Return a new array with the given shape. Repeats data if the new shape is larger. See [resize](https://numpyts.dev/v1.7.x/api/manipulation/shape.md).

### bindex

```typescript theme={null}
bindex(mask: NDArray, axis?: number): NDArray
```

Boolean array indexing. Select elements where `mask` is `true`. See [compress](https://numpyts.dev/v1.7.x/api/indexing/advanced-indexing.md).

### iindex

```typescript theme={null}
iindex(indices: NDArray | number[] | number[][], axis?: number): NDArray
```

Integer array indexing (fancy indexing). Select elements by an array of indices. See [take](https://numpyts.dev/v1.7.x/api/indexing/advanced-indexing.md).

***

## Complex number methods

### conj

```typescript theme={null}
conj(): NDArray
```

Return the complex conjugate, element-wise. For real arrays, returns a copy. See [conj](https://numpyts.dev/v1.7.x/api/math/other-math.md).

### conjugate

```typescript theme={null}
conjugate(): NDArray
```

Alias for `conj`. See [conj](https://numpyts.dev/v1.7.x/api/math/other-math.md).

***

## Other methods

### copy

```typescript theme={null}
copy(): NDArray
```

Return a deep copy. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#copy).

### astype

```typescript theme={null}
astype(dtype: DType, copy?: boolean): NDArray
```

Cast to a new dtype. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#astype).

### fill

```typescript theme={null}
fill(value: number | bigint): void
```

Fill array in-place with a scalar. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#fill).

### toArray

```typescript theme={null}
toArray(): NestedArray
```

Convert to nested JavaScript array. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#toarray).

### tolist

```typescript theme={null}
tolist(): NestedArray
```

Same as `toArray`. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#tolist).

### tobytes

```typescript theme={null}
tobytes(): ArrayBuffer
```

Serialize to raw bytes. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#tobytes).

### get

```typescript theme={null}
get(indices: number[]): number | bigint | Complex
```

Get element by multi-dimensional indices. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#get).

### set

```typescript theme={null}
set(indices: number[], value: number | bigint | Complex): void
```

Set element by multi-dimensional indices. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#set).

### slice

```typescript theme={null}
slice(...sliceStrs: string[]): NDArray
```

NumPy-style string slicing. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#slice).

### row

```typescript theme={null}
row(i: number): NDArray
```

Get row `i`. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#row).

### col

```typescript theme={null}
col(j: number): NDArray
```

Get column `j`. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#col).

### rows

```typescript theme={null}
rows(start: number, stop: number): NDArray
```

Get a range of rows. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#rows).

### cols

```typescript theme={null}
cols(start: number, stop: number): NDArray
```

Get a range of columns. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#cols).

### item

```typescript theme={null}
item(...args: number[]): number | bigint | Complex
```

Extract a scalar value. See [NDArray Class](https://numpyts.dev/v1.7.x/api/ndarray/class.md#item).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.