-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Conversation
pandas/_libs/tslibs/util.pxd
Outdated
""" | ||
return PyObject_TypeCheck(obj, &PySignedIntegerArrType_Type) | ||
|
||
cdef inline bint is_uinteger_object(object obj) nogil: |
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.
…16_regr � Conflicts: � doc/source/whatsnew/v1.5.0.rst
[np.uint64(1)], | ||
], | ||
) | ||
def test_constructor_numpy_uints(self, values): |
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.
are pd.Index or pd.array affected? pd.NumericIndex?
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.
pd.array and pd.NumericIndex are not impacted; I've added tests for Index.
arr = pd.array([np.uint16(1)])
print(arr)
# <IntegerArray>
# [1]
# Length: 1, dtype: Int64
index = NumericIndex([np.uint16(1)])
print(index)
# NumericIndex([1], dtype='uint16')
Both of these are the same as 1.4.3
thanks @rhshadrach |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.I think this is closely related to #37258, though it does not impact any code examples there.
cc @TomAugspurger, @jbrockmendel, @jorisvandenbossche