-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
BUG: Convert uint64 in maybe_convert_objects #14916
Conversation
5aee259
to
92f10f3
Compare
Current coverage is 84.64% (diff: 100%)@@ master #14916 diff @@
==========================================
Files 144 144
Lines 51016 51016
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43184 43185 +1
+ Misses 7832 7831 -1
Partials 0 0
|
try: | ||
ints[i] = val | ||
except OverflowError: | ||
seen_uint = seen_uint or (val > np.iinfo(np.int64).max) |
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 would pull set np.iinfo(np.int64).max as a constant in the module.
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.
@@ -234,6 +234,21 @@ def test_empty_like(self): | |||
self._check_behavior(arr, expected) | |||
|
|||
|
|||
def test_maybe_convert_objects_uint64(): |
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.
these tests are all in
pandas.types.test_inference
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.
@@ -251,3 +251,4 @@ Bug Fixes | |||
|
|||
|
|||
- Require at least 0.23 version of cython to avoid problems with character encodings (:issue:`14699`) | |||
- Bug in ``lib.maybe_convert_objects()`` in which unsigned 64-bit integers were not being properly converted (:issue:`4471`) |
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.
this is not public. I would refer to this more generically (maybe also construct a test which actually hits this in practice from a user perspective)
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.
Fair enough. Done.
edb04d3
to
47de0df
Compare
Adds handling for uint64 objects during conversion. When negative numbers and uint64 are detected, we then convert the result to object. Picks up where pandas-devgh-4845 left off. Closes pandas-devgh-4471.
47de0df
to
ed325cd
Compare
thanks! |
Adds handling for `uint64` objects during conversion. When negative numbers and `uint64` are detected, we then convert the result to `object`. Picks up where pandas-dev#4845 left off. Closes pandas-dev#4471. Author: gfyoung <gfyoung17@gmail.com> Closes pandas-dev#14916 from gfyoung/convert-objects-uint64 and squashes the following commits: ed325cd [gfyoung] BUG: Convert uint64 in maybe_convert_objects
1) Introduces and propagates `UInt64Index`, an index specifically for `uint`. xref #14935 2) <strike> Patches bug from #14916 that makes `maybe_convert_objects` robust against the known `numpy` bug that `uint64` cannot be compared to `int64`. This bug was caught during testing of `UInt64Index`. </strike> **UPDATE**: Patched in #14951 Author: gfyoung <gfyoung17@gmail.com> Closes #14937 from gfyoung/create-uint64-index and squashes the following commits: 8ab6fbd [gfyoung] ENH: Create and propagate UInt64Index
1) Introduces and propagates `UInt64Index`, an index specifically for `uint`. xref pandas-dev#14935 2) <strike> Patches bug from pandas-dev#14916 that makes `maybe_convert_objects` robust against the known `numpy` bug that `uint64` cannot be compared to `int64`. This bug was caught during testing of `UInt64Index`. </strike> **UPDATE**: Patched in pandas-dev#14951 Author: gfyoung <gfyoung17@gmail.com> Closes pandas-dev#14937 from gfyoung/create-uint64-index and squashes the following commits: 8ab6fbd [gfyoung] ENH: Create and propagate UInt64Index
Adds handling for
uint64
objects during conversion. When negative numbers anduint64
are detected, we then convert the result toobject
.Picks up where #4845 left off. Closes #4471.