NumPy for Data Science – Part 3
Naveen
- 0
Arithmetic Operations in NumPy Arrays
In NumPy there are multiple functions which we can use to perform the arithmetic operation, we will be looking them one by one.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-127.png)
The add() function can also be used to perform the same operation.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-128.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-129.png)
The subtract() function can also be used to perform the same operation.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-130.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-131.png)
The multiply() function can also be used to perform the same operation.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-132.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-133.png)
Both the mod() and the remainder() functions return the remainder of the values in the first array corresponding to the values in the second array, and return the results in a new array.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-134.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-135.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-136.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-137.png)
The divide() can also be used to perform the same operation.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-138.png)
Arithmetic Functions
The max() function will return the maximum value of the array and min() will return the minimum value of the array. Sqrt() returns the square root.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-139.png)
Conclusion
In this article we have seen how to perform Arithmetic Operations and Arithmetic Functions. In the next part will be looking into Broadcasting NumPy Arrays.
NumPy for Data Science – Part 1
NumPy for Data Science – Part 2
Popular Posts
Spread the knowledge