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

Using the Numpy numpy.ndarray .__ divmod __ () method we get two arrays, one of which has elements that are divisible by values provided in numpy.ndarray .__ divmod __ () and the second — elements that make the mod work with the same value as specified in numpy.ndarray .__ divmod __ () .

Syntax : ndarray .__ divmod __ (\$ self, value, /)

Return: divmod (self, value)

Example # 1:
In this example, we see that with ndarray .__ divmod __ () we get two arrays. One with a division with the value that is passed as a parameter, and the other with the values ​​of the mod.

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

Exit:

(array ([0, 0, 1, 1, 1]), array ([1, 2, 0, 1, 2]))

Example # 2:

 # import important module in 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 .__ divmod __ () print (gfg .__ divmod __ ( 3 ))

Exit:

(array ([[0, 0, 1 , 1, 1], [2, 1, 1, 1, 0]]), array ([[1, 2, 0, 1, 2], [0, 2, 1, 0, 2]]))