numpy.mod

numpy.mod(x1, x2[, out])

Returns element-wise remainder of division.

Computes x1 - floor(x1/x2)*x2.

Parameters:

x1 : array_like

Dividend array.

x2 : array_like

Divisor array.

Returns:

y : ndarray

The remainder of the quotient x1/x2, element-wise. Returns a scalar if both x1 and x2 are scalars.

See also

divide, floor

Notes

Returns 0 when x2 is 0.

Examples

>>> np.remainder([4,7],[2,3])
array([0, 1])

Previous topic

numpy.fmod

Next topic

numpy.modf

This Page

Quick search