Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference bettween numpy.mod() and numpy.remainder()?

Consider the following code

import numpy as np 
a = np.array([10,20,30]) 
b = np.array([3,5,7]) 

print(np.mod(a,b))

Output:

[1 0 2]

import numpy as np 
a = np.array([10,20,30]) 
b = np.array([3,5,7]) 

print(np.remainder(a,b))

Output:

[1 0 2]

Both functions gave the same value, are there any differences?

like image 280
Ranjith Udayakumar Avatar asked Dec 11 '18 07:12

Ranjith Udayakumar


1 Answers

No difference, they are aliases:

>>> np.mod is np.remainder
True

Specifically, mod is alias for remainder:

>>> np.mod.__name__
'remainder'
like image 147
wim Avatar answered Oct 02 '22 10:10

wim