numpy.divmod(x1,x2,[out1,out2,]/,[out=(None,None),]*,where=True,casting='same_kind',order='K',dtype=None,subok=True[,signature,extobj]) = <ufunc 'divmod'>¶Return element-wise quotient and remainder simultaneously.
New in version 1.13.0.
np.divmod(x,y) is equivalent to(x//y,x%y), but fasterbecause it avoids redundant work. It is used to implement the Pythonbuilt-in functiondivmod on NumPy arrays.
| Parameters: |
|
|---|---|
| Returns: |
|
See also
floor_divide// operator.remainder% operator.modfdivmod(x,1) for positivex with the return values switched.Examples
>>>np.divmod(np.arange(5),3)(array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1]))