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

NumPy | Python Methods and Functions

Using the `numpy.ndarray.__imul__() ` method we can multiply a specific value provided as a parameter in ` ndarray .__ imul __ () ` ... The value will be multiplied by each element in the array.

Synatx: ndarray .__ imul __ (\$ self, value, /)

Return: self * = value

Example # 1:
In this example, we see that each the array element is multiplied by the value specified as a parameter in the ` ndarray .__ imul __ () ` 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 method .__ imul __ () ` ` print ` ` (gfg .__ imul __ (` ` 5 ` `)) `

Exit:

` [6. 13. 15. 22.5 25 .] `

Example # 2:

 ` # import 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 .__ imul __ () print (gfg .__ imul __ ( 3 )) `

Exit:

` [[3. 6.6 9. 12. 15.03] [18.3 15. 14.4 9. 6.]] `