Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@WarrenWeckesser
Copy link
Member

@WarrenWeckesser WarrenWeckesser commented Nov 11, 2025

With this PR, sign(timedelta64) returns a float64. The ensures that the sign function has the basic property x = np.sign(x)*np.abs(x) when x has dtype timedelta64, including the case where x is NaT.

The PR makes the change with no warnings and no deprecation, and it has not been decided that that is OK! So this is a draft PR until a final decision is made about how to resolve gh-8463.

The issue was brought up on the mailing list: https://mail.python.org/archives/list/[email protected]/thread/7ELIJOAAZAMFIGNDAUMOCLXYBRYYKE2Z/

Closes gh-8463.
Closes gh-29496.

@WarrenWeckesser
Copy link
Member Author

If this change is accepted, it should not be merged until after 2.4.0 is branched, so it would be in 2.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: sign(timedelta64('nat')) returns -1; expected timedelta64('nat') sign for any positive timedelta should be/compare equal

1 participant