8.5.38. Array

class Array[source]

Methods

__init__

all

a.all(axis=None, out=None, keepdims=False, *, where=True)

any

a.any(axis=None, out=None, keepdims=False, *, where=True)

argmax

a.argmax(axis=None, out=None, *, keepdims=False)

argmin

a.argmin(axis=None, out=None, *, keepdims=False)

argpartition

a.argpartition(kth, axis=-1, kind='introselect', order=None)

argsort

a.argsort(axis=-1, kind=None, order=None)

astype

a.astype(dtype, order='K', casting='unsafe', subok=True, copy=True)

byteswap

a.byteswap(inplace=False)

choose

a.choose(choices, out=None, mode='raise')

clip

a.clip(min=None, max=None, out=None, **kwargs)

collapse

compress

a.compress(condition, axis=None, out=None)

conj

a.conj()

conjugate

a.conjugate()

copy

a.copy(order='C')

cumprod

a.cumprod(axis=None, dtype=None, out=None)

cumsum

a.cumsum(axis=None, dtype=None, out=None)

diagonal

a.diagonal(offset=0, axis1=0, axis2=1)

dot

dump

a.dump(file)

dumps

a.dumps()

fill

a.fill(value)

flatten

a.flatten(order='C')

getfield

a.getfield(dtype, offset=0)

item

a.item(*args)

max

a.max(axis=None, out=None, keepdims=False, initial=<no value>, where=True)

mean

a.mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)

min

a.min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)

nonzero

a.nonzero()

partition

a.partition(kth, axis=-1, kind='introselect', order=None)

prod

a.prod(axis=None, dtype=None, out=None, keepdims=False,

put

a.put(indices, values, mode='raise')

ravel

a.ravel([order])

repeat

a.repeat(repeats, axis=None)

reshape

a.reshape(shape, /, *, order='C', copy=None)

resize

a.resize(new_shape, refcheck=True)

round

a.round(decimals=0, out=None)

searchsorted

a.searchsorted(v, side='left', sorter=None)

setfield

a.setfield(val, dtype, offset=0)

setflags

a.setflags(write=None, align=None, uic=None)

sort

a.sort(axis=-1, kind=None, order=None)

squeeze

a.squeeze(axis=None)

std

a.std(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)

sum

a.sum(axis=None, dtype=None, out=None, keepdims=False, initial=0, where=True)

swapaxes

a.swapaxes(axis1, axis2)

take

a.take(indices, axis=None, out=None, mode='raise')

to_device

tobytes

a.tobytes(order='C')

tofile

a.tofile(fid, sep="", format="%s")

tolist

a.tolist()

trace

a.trace(offset=0, axis1=0, axis2=1, dtype=None, out=None)

transpose

a.transpose(*axes)

var

a.var(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)

view

a.view([dtype][, type])

__init__()

Attributes

T

View of the transposed array.

base

Base object if memory is from some other object.

ctypes

An object to simplify the interaction of the array with the ctypes module.

data

Python buffer object pointing to the start of the array's data.

device

dtype

Data-type of the array's elements.

flags

Information about the memory layout of the array.

flat

A 1-D iterator over the array.

imag

The imaginary part of the array.

itemset

itemsize

Length of one array element in bytes.

mT

View of the matrix transposed array.

nbytes

Total bytes consumed by the elements of the array.

ndim

Number of array dimensions.

newbyteorder

ptp

real

The real part of the array.

shape

Tuple of array dimensions.

size

Number of elements in the array.

strides

Tuple of bytes to step in each dimension when traversing an array.

reshape(shape, /, *, order='C', copy=None)[source]

Returns an array containing the same data with a new shape.

Refer to numpy.reshape for full documentation.

8.5.38. See Also

numpy.reshape : equivalent function

8.5.38. Notes

Unlike the free function numpy.reshape, this method on ndarray allows the elements of the shape parameter to be passed in as separate arguments. For example, a.reshape(10, 11) is equivalent to a.reshape((10, 11)).