remainder(x1, x2, out=None, **kwargs)

Return element-wise remainder of division.

  • x1 (ndarray or scalar) – Dividend array.

  • x2 (ndarray or scalar) – Divisor array.

  • out (ndarray) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.


out – This is a scalar if both x1 and x2 are scalars.

Return type

ndarray or scalar


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