-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
REGR: maybe_convert_objects ignoring uints #47475
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
834b1be
6e3857a
e62b306
4e4cac9
6387823
9458e40
9f69eda
9ca2f40
5151dca
a2f77f4
7c1c72e
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 |
---|---|---|
|
@@ -745,6 +745,25 @@ def test_constructor_signed_int_overflow_deprecation(self): | |
expected = Series([1, 200, 50], dtype="uint8") | ||
tm.assert_series_equal(ser, expected) | ||
|
||
@pytest.mark.parametrize( | ||
"values", | ||
[ | ||
np.array([1], dtype=np.uint16), | ||
np.array([1], dtype=np.uint32), | ||
np.array([1], dtype=np.uint64), | ||
[np.uint16(1)], | ||
[np.uint32(1)], | ||
[np.uint64(1)], | ||
], | ||
) | ||
def test_constructor_numpy_uints(self, values): | ||
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. are pd.Index or pd.array affected? pd.NumericIndex? 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. pd.array and pd.NumericIndex are not impacted; I've added tests for Index.
Both of these are the same as 1.4.3 |
||
# GH#47294 | ||
value = values[0] | ||
result = Series(values) | ||
|
||
assert result[0].dtype == value.dtype | ||
assert result[0] == value | ||
|
||
def test_constructor_unsigned_dtype_overflow(self, any_unsigned_int_numpy_dtype): | ||
# see gh-15832 | ||
msg = "Trying to coerce negative values to unsigned integers" | ||
|
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.
do you expect these to be used elsewhere? if not, i think the build might be marginally faster (maybe even smaller) if they go directly in lib.pyx
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.
I'd hazard a guess no. Also, I had reservations on the
is_sinteger_object
function anyways; it would return False even if e.g. -1 is passed, which is possibly the wrong answer depending on use. But every other function there only looked at the type of object, so it seemed wrong to add a function with value-dependent behavior. Inlining these gets around that.