  # Python | Numpy numpy.ndarray .__ isub __ ()

NumPy | Python Methods and Functions

Using the `numpy.ndarray.__isub__() ` method we can subtract a specific value that is provided as a parameter in the ` ndarray .__ isub __ () . The value will be subtracted to each item in the numpy array. `

` Syntax: ndarray .__ isub __ (\$ self, value, /) Return: self- = value Example # 1: In this example, we see that each the array element is subtracted with the value specified as a parameter in the ndarray .__ isub __ () method. Remember that this method will work for every type of numeric value. # import important module into python import numpy as np   # make an array with NumPy gfg = np.array ([ 1.2 , 2.6 , 3 , 4.5 , 5 ])   # applying the ndarray .__ isub __ () method print  (gfg .__ isub __ ( 5 )) `

` ` Exit:

` [-3.8 -2.4 -2. -0.5 0.] `

Example # 2:

 ` # import an important module into python `` import numpy as np   # make an array with NumPy gfg = np.array ([[ 1 , 2.2 , 3 , 4 , 5.01 ],   [ 6.1 , 5 , 4.8 , 3 , 2 ]])   # applying the ndarray method .__ isub __ () print (gfg .__ isub __ ( 3 )) `

Exit:

` [[-2. -0.8 0. 1. 2.01] [3.1 2. 1.8 0. -1. ]] `