Class has a very important job as a core container type in Python. It is really hard to find a good overview how to use them in a good practice manner.
Questions to [David Rotermund](mailto:davrot@uni-bremen.de)
## [numpy.ndarray.sum](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.sum.html) and [numpy.ndarray.mean](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.mean.html#numpy.ndarray.mean)
> Return an array whose values are limited to [min, max]. One of max or min must be given.
```python
import numpy as np
A = np.arange(0, 8).reshape((2, 4))
print(A)
print()
print(A.clip(min=1, max=6))
```
Output:
```python
[[0 1 2 3]
[4 5 6 7]]
[[1 1 2 3]
[4 5 6 6]]
```
## [numpy.ndarray.max](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.max.html#numpy.ndarray.max) and [numpy.ndarray.min](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.min.html#numpy.ndarray.min)
## [numpy.ndarray.argmax](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.argmax.html#numpy.ndarray.argmax) and [numpy.ndarray.argmin](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.argmin.html#numpy.ndarray.argmin)
|[ndarray.item(*args)](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.item.html#numpy.ndarray.item)|Copy an element of an array to a standard Python scalar and return it.|
|[ndarray.tolist()](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tolist.html#numpy.ndarray.tolist)|Return the array as an a.ndim-levels deep nested list of Python scalars.|
|[ndarray.itemset(*args)](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.itemset.html#numpy.ndarray.itemset)|Insert scalar into an array (scalar is cast to array's dtype, if possible)|
|[ndarray.tostring([order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tostring.html#numpy.ndarray.tostring)|A compatibility alias for tobytes, with exactly the same behavior.|
|[ndarray.tobytes([order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tobytes.html#numpy.ndarray.tobytes)|Construct Python bytes containing the raw data bytes in the array.|
|[ndarray.tofile(fid[, sep, format])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tofile.html#numpy.ndarray.tofile)|Write array to a file as text or binary (default).|
|[ndarray.dump(file)](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.dump.html#numpy.ndarray.dump)|Dump a pickle of the array to the specified file.|
|[ndarray.dumps()](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.dumps.html#numpy.ndarray.dumps)|Returns the pickle of the array as a string.|
|[ndarray.astype(dtype[, order, casting, ...])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.astype.html#numpy.ndarray.astype)|Copy of the array, cast to a specified type.|
|[ndarray.byteswap([inplace])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.byteswap.html#numpy.ndarray.byteswap)|Swap the bytes of the array elements|
|[ndarray.copy([order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.copy.html#numpy.ndarray.copy)|Return a copy of the array.|
|[ndarray.view([dtype][, type])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.view.html#numpy.ndarray.view)|New view of array with the same data.|
|[ndarray.getfield(dtype[, offset])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.getfield.html#numpy.ndarray.getfield)|Returns a field of the given array as a certain type.|
|[ndarray.fill(value)](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.fill.html#numpy.ndarray.fill)|Fill the array with a scalar value.|
|[ndarray.reshape(shape[, order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.reshape.html#numpy.ndarray.reshape)|Returns an array containing the same data with a new shape.|
|[ndarray.resize(new_shape[, refcheck])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.resize.html#numpy.ndarray.resize)|Change shape and size of array in-place.|
|[ndarray.transpose(*axes)](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.transpose.html#numpy.ndarray.transpose)|Returns a view of the array with axes transposed.|
|[ndarray.swapaxes(axis1, axis2)](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.swapaxes.html#numpy.ndarray.swapaxes)|Return a view of the array with axis1 and axis2 interchanged.|
|[ndarray.flatten([order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.flatten.html#numpy.ndarray.flatten)|Return a copy of the array collapsed into one dimension.|
|[ndarray.ravel([order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ravel.html#numpy.ndarray.ravel)|Return a flattened array.|
|[ndarray.squeeze([axis])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.squeeze.html#numpy.ndarray.squeeze)|Remove axes of length one from a.|
|[ndarray.take(indices[, axis, out, mode])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.take.html#numpy.ndarray.take)|Return an array formed from the elements of a at the given |indices.
|[ndarray.put(indices, values[, mode])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.put.html#numpy.ndarray.put)|Set a.flat[n] = values[n] for all n in indices.|
|[ndarray.repeat(repeats[, axis])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.repeat.html#numpy.ndarray.repeat)|Repeat elements of an array.|
|[ndarray.choose(choices[, out, mode])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.choose.html#numpy.ndarray.choose)|Use an index array to construct a new array from a set of choices.|
|[ndarray.sort([axis, kind, order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.sort.html#numpy.ndarray.sort)|Sort an array in-place.|
|[ndarray.argsort([axis, kind, order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.argsort.html#numpy.ndarray.argsort)|Returns the indices that would sort this array.|
|[ndarray.partition(kth[, axis, kind, order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.partition.html#numpy.ndarray.partition)|Rearranges the elements in the array in such a way that the value of the element in kth position is in the position it would be in a sorted array.|
|[ndarray.argpartition(kth[, axis, kind, order])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.argpartition.html#numpy.ndarray.argpartition)|Returns the indices that would partition |this array.
|[ndarray.searchsorted(v[, side, sorter])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.searchsorted.html#numpy.ndarray.searchsorted)|Find indices where elements of v should be inserted in a to maintain order.|
|[ndarray.nonzero()](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.nonzero.html#numpy.ndarray.nonzero)|Return the indices of the elements that are non-zero.|
|[ndarray.compress(condition[, axis, out])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.compress.html#numpy.ndarray.compress)|Return selected slices of this array along given axis.|
|[ndarray.max([axis, out, keepdims, initial, ...])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.max.html#numpy.ndarray.max)|Return the maximum along a given axis.|
|[ndarray.argmax([axis, out, keepdims])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.argmax.html#numpy.ndarray.argmax)|Return indices of the maximum values along the given axis.|
|[ndarray.min([axis, out, keepdims, initial, ...])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.min.html#numpy.ndarray.min)|Return the minimum along a given axis.|
|[ndarray.argmin([axis, out, keepdims])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.argmin.html#numpy.ndarray.argmin)|Return indices of the minimum values along the given axis.|
|[ndarray.ptp([axis, out, keepdims])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ptp.html#numpy.ndarray.ptp)|Peak to peak (maximum - minimum) value along a given axis.|
|[ndarray.clip([min, max, out])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.clip.html#numpy.ndarray.clip)|Return an array whose values are limited to [min, max].|
|[ndarray.conj()](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.conj.html#numpy.ndarray.conj)|Complex-conjugate all elements.|
|[ndarray.round([decimals, out])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.round.html#numpy.ndarray.round)|Return a with each element rounded to the given number of decimals.|
|[ndarray.trace([offset, axis1, axis2, dtype, out])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.trace.html#numpy.ndarray.trace)|Return the sum along diagonals of the array.|
|[ndarray.sum([axis, dtype, out, keepdims, ...])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.sum.html#numpy.ndarray.sum)|Return the sum of the array elements over the given axis.|
|[ndarray.cumsum([axis, dtype, out])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.cumsum.html#numpy.ndarray.cumsum)|Return the cumulative sum of the elements along the given axis.|
|[ndarray.mean([axis, dtype, out, keepdims, where])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.mean.html#numpy.ndarray.mean)|Returns the average of the array elements along given axis.|
|[ndarray.var([axis, dtype, out, ddof, ...])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.var.html#numpy.ndarray.var)|Returns the variance of the array elements, along given axis.|
|[ndarray.std([axis, dtype, out, ddof, ...])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.std.html#numpy.ndarray.std)|Returns the standard deviation of the array elements along given axis.|
|[ndarray.prod([axis, dtype, out, keepdims, ...])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.prod.html#numpy.ndarray.prod)|Return the product of the array elements over the given axis|
|[ndarray.cumprod([axis, dtype, out])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.cumprod.html#numpy.ndarray.cumprod)|Return the cumulative product of the elements along the given axis.|
|[ndarray.all([axis, out, keepdims, where])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.all.html#numpy.ndarray.all)|Returns True if all elements evaluate to True.|
|[ndarray.any([axis, out, keepdims, where])](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.any.html#numpy.ndarray.any)|Returns True if any of the elements of a evaluate to True.|
> Each of the arithmetic operations (+, -, *, /, //, %, divmod(), ** or pow(), <<, >>, &, ^, \|, ~) and the comparisons (==, <, >, <=, >=, !=) is equivalent to the corresponding universal function in NumPy.
for in-place operations see [here](https://numpy.org/doc/stable/reference/arrays.ndarray.html#arithmetic-matrix-multiplication-and-comparison-operations)
|[ndarray.\_\_bool\_\_(/)](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.__bool__.html#numpy.ndarray.__bool__)|True if self else False|