Skip to content

Conversation

@hellerve
Copy link
Contributor

This PR replaces all occurrences of numpy.fix with numpy.trunc. This is in response to a currently discussed deprecation of numpy.fix as well as performance considerations (nice, but secondary).

This change should not change anything in a meaningful way, internally or externally.

It is, however, unclear to me whether this PR should also remove test_np_fix in test_ufunc.py. I opted to keep it. If desired, I can make this part of the PR. It is worth noting that no corresponding test_np_trunc exists (should it?).

@pytest.mark.xfail(reason="see https://github.com/pandas-dev/pandas/pull/51082")
def test_np_fix():
# np.fix is not a ufunc but is composed of several ufunc calls under the hood
# with `out` and `where` keywords
ser = pd.Series([-1.5, -0.5, 0.5, 1.5])
result = np.fix(ser)
expected = pd.Series([-1.0, -0.0, 0.0, 1.0])
tm.assert_series_equal(result, expected)

Cheers

@mroeschke mroeschke added this to the 3.0 milestone Nov 11, 2025
@mroeschke mroeschke merged commit d329bc5 into pandas-dev:main Nov 11, 2025
46 checks passed
@mroeschke
Copy link
Member

Thanks @hellerve. We can keep test_np_fix until numpy officially deprecates it

@hellerve
Copy link
Contributor Author

Perfect. I’ll submit another PR once I get the deprecation PR at numpy through :)

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.

2 participants