-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: (re-)enable infer_dtype to catch complex #25382
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 1 commit
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 |
---|---|---|
|
@@ -618,6 +618,30 @@ def test_decimals(self): | |
result = lib.infer_dtype(arr, skipna=True) | ||
assert result == 'decimal' | ||
|
||
def test_complex(self): | ||
# gets cast to complex on array construction | ||
arr = np.array([1.0, 2.0, 1 + 1j]) | ||
result = lib.infer_dtype(arr, skipna=True) | ||
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. does skipna=False matter anywhere here? 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. No, because 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. the parametrize over skipna |
||
assert result == 'complex' | ||
|
||
arr = np.array([1.0, 2.0, 1 + 1j], dtype='O') | ||
result = lib.infer_dtype(arr, skipna=True) | ||
assert result == 'mixed' | ||
|
||
# gets cast to complex on array construction | ||
arr = np.array([1, np.nan, 1 + 1j]) | ||
result = lib.infer_dtype(arr, skipna=True) | ||
assert result == 'complex' | ||
|
||
arr = np.array([1.0, np.nan, 1 + 1j], dtype='O') | ||
result = lib.infer_dtype(arr, skipna=True) | ||
assert result == 'mixed' | ||
|
||
# complex with nans stays complex | ||
arr = np.array([1 + 1j, np.nan, 3 + 3j], dtype='O') | ||
result = lib.infer_dtype(arr, skipna=True) | ||
assert result == 'complex' | ||
|
||
def test_string(self): | ||
pass | ||
|
||
|
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.
what system actually hits this? AFAIK numpy doesn't use this on a regular basis
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.
Well, it's as easy to use as
float32
on a 64-bit platform. I just added it for completeness.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.
ok see if u can come up with a test then maybe have to force numpy to construct it