numpy\'s round int doesn\'t seem to be consistent with how it deals with xxx.5
In [2]: np.rint(1.5) Out[2]: 2.0 In [3]: np.rint(10.5) Out[3]: 10.0 <
In [2]: np.rint(1.5) Out[2]: 2.0 In [3]: np.rint(10.5) Out[3]: 10.0
Not sure its the most efficient solution but it works:
signs = np.sign(arr) tmp = signs * arr arr = np.floor(tmp + 0.5) arr = arr * signs