-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REGR: diff_2d raising for int8, int16 #39069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
72cd1ac
5c818d8
4278126
ca5fa87
01e1fdd
ae7ed31
a015967
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2409,3 +2409,10 @@ def test_diff_ea_axis(self): | |
msg = "cannot diff DatetimeArray on axis=1" | ||
with pytest.raises(ValueError, match=msg): | ||
algos.diff(dta, 1, axis=1) | ||
|
||
@pytest.mark.parametrize("dtype", ["int8", "int16"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you also add a replica of the test from the OP in groupby tests. I don't think we actually have any :sigh: pandas/tests/groupby//test_groupby.py near shift is fine (or actually ok with moving the shift & diff tests out to a new file). pls add for all dtypes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added test from issue and for other dtypes |
||
def test_diff_low_precision_int(self, dtype): | ||
arr = np.array([0, 1, 1, 0, 0], dtype=dtype) | ||
result = algos.diff(arr, 1) | ||
expected = np.array([np.nan, 1, 0, -1, 0], dtype="float32") | ||
tm.assert_numpy_array_equal(result, expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where exactly is the NotImplmementedError coming from. This should work as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought this change made sense because of this logic:
pandas/pandas/_libs/algos.pyx
Lines 1270 to 1277 in 66a30bd
Was raising in that second branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grr this is super annoying. ok can you add this reference where you are making the code change itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done