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

With ` Numpy numpy.ndarray .__ sub __ () ` we can subtract a specific value that is provided as a parameter in ` ndarray .__ sub __ () . The value will be subtracted for each item in the numpy array . `

``` Syntax: ndarray .__ sub __ (\$ self, value, /) Return: self-value Example # 1: In this example, we see that each element the array is subtracted with the value specified as a parameter in the ndarray .__ sub __ () method. Remember one thing, this will not work for double values. # import important module into python import numpy as np   # make an array with NumPy gfg = np.array ([ 1 , 2 , 3 , 4 , 5 ] )   # applying the ndarray method .__ sub __ ()  print (gfg .__ sub __ ( 5 )) ```

` ` Exit:

` [-4 -3 -2 - 1 0] `

Example # 2:

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

Output:

` [[-4 -3 -2 -1 0] [1 0 -1 -2 -3]] `