-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Reorder tests in maybe_downcast_numeric #55825
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 5 commits
80b5bc6
51ee73c
4594c5c
dc9851d
8c6bfe1
450315e
2815572
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 |
---|---|---|
|
@@ -357,15 +357,13 @@ def trans(x): | |
# if we don't have any elements, just astype it | ||
return trans(result).astype(dtype) | ||
|
||
# do a test on the first element, if it fails then we are done | ||
r = result.ravel() | ||
arr = np.array([r[0]]) | ||
|
||
if isna(arr).any(): | ||
# if we have any nulls, then we are done | ||
return result | ||
|
||
elif not isinstance(r[0], (np.integer, np.floating, int, float, bool)): | ||
if isinstance(result, np.ndarray): | ||
element = result[0] | ||
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. would 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. My suggestion here turns out to cause a different problem bc .item(0) is wrong for dt64 ndarrays
|
||
else: | ||
element = result.iloc[0] | ||
if isinstance(element, np.ndarray): | ||
element = element.ravel()[0] | ||
if not isinstance(element, (np.integer, np.floating, int, float, bool)): | ||
# a comparable, e.g. a Decimal may slip in here | ||
return result | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.