October 2019
Beginner to intermediate
674 pages
16h 43m
English
The mathematical operators of NumPy can mainly support trigonometric operations, arithmetic operations, and exponential and logarithmic operations.
A class of these operators, such as prod, sum, and so on, perform computations within the array and serve to reduce the matrix. For example, the sum function calculates the sum along a given axis. The output will be the sum of elements along the axis. These functions can be called as a numpy.function or as an ndarray.method:
# Sum of all elements in an arrayIn [62]: np.array([[1, 2, 3], [4, 5, 6]]).sum()Out[62]: 21# Column sum of elementsIn [63]: np.array([[1, 2, 3], [4, 5, 6]]).sum(axis = 0)Out[63]: array([5, 7, 9])# Cumulative sum of elements along axis 0In [64]: np.array([[1, ...
Read now
Unlock full access