15 Numpy Functionalities That Every Data Scientist Must Know

https://miro.medium.com/max/1200/0*Stt4-x0BzLcZ25hI

Original Source Here

14. Minimum, Maximum, And Absolute:

a = np.array([1, 2, -3, 4, 5])
print(np.min(a))
print(np.max(a))
print(np.abs(a))

Output: -3
5
[1 2 3 4 5]

Looking at some other basic operations that we can perform with numpy arrays are to find out the minimum, maximum, and absolute values of a particular numpy array. The np.min() and np.max() functions are quite self-explanatory as these operations are used to compute the minimum and maximum values in the given numpy array, respectively.

While the other two functions return a single value, which is either a single minimum or maximum value, the absolute function will return back an array. However, all the base values are returned without the consideration of the negative sign. The other similar functions which I would recommend the users to experiment with are operations on the ceiling, flooring, and other such operations.

15. Trigonometric functions:

print(np.sin(np.pi/3.))
print(np.cos(np.pi/3.))

Output: 0.8660254037844386
0.5000000000000001

Apart from all the exceptional tasks that you achieve with numpy arrays, you can also perform trigonometric operations with this library. In the above example, we have performed a couple of simple trigonometric operations on sine and cosine for sixty degrees to achieve their respective results. Feel free to explore other similar trigonometric functions.

AI/ML

Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot

%d bloggers like this: