Arithmetic Operations

Let’s learn about the use of various arithmetic operations in NumPy arrays.

We'll cover the following

We can perform arithmetic operations with NumPy arrays. Arithmetic operations in the NumPy array work the same way as they do with numbers.

  • Element-wise addition of two arrays is done using +.
  • Element-wise subtraction of two arrays is done using -.
  • Element-wise multiplication of two arrays is done using *.
  • Element-wise division of two arrays is done using /.
  • The power of all elements in an array is obtained using **.

If we attempt to divide zero by zero (0/0), we get NaN.

Let’s learn with examples:

Get hands-on with 1200+ tech skills courses.