[Numpy-discussion] timedelta64 remainder behavior with div by 0

Stefan van der Walt stefanv at berkeley.edu
Tue Jan 8 13:05:22 EST 2019


On Tue, 08 Jan 2019 09:57:03 -0800, Tyler Reddy wrote:
> np.timedelta64(5) % np.timedelta64(0) -> numpy.timedelta64(0)
> 
> In contrast, np.float64(1) % np.float64(0) -> nan
> 
> There's a suggestion that we should switch to returning NaT for the
> timedelta64 case for consistency, and that this probably isn't too harmful
> given how recent these additions are.

That seems like a reasonable change to me; one could probably consider the
previous behavior a bug?

Stéfan


More information about the NumPy-Discussion mailing list