-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Makes NumericIndex constructor dtype aware #29529
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
5bd9720
5ad038f
d620c51
efc846d
a59a945
5c7c65c
9ab3596
14e4e03
68fe304
458c25e
1df13c0
e6d5f6b
a51bcec
13bda84
60b4f7b
b41893d
c9db704
5603e0f
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 |
---|---|---|
|
@@ -57,7 +57,7 @@ def __new__(cls, data=None, dtype=None, copy=False, name=None, fastpath=None): | |
return cls._simple_new(data, name=name) | ||
|
||
# is_scalar, generators handled in coerce_to_ndarray | ||
data = cls._coerce_to_ndarray(data) | ||
data = cls._coerce_to_ndarray(data, dtype=dtype) | ||
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. I don't think this should rely on 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. This initially made sense to me. However, In [1]: import numpy as np
...: np.__version__
Out[1]: '1.17.3'
In [2]: np.array([1, "2"])
...:
Out[2]: array(['1', '2'], dtype='<U21')
In [3]: np.array(["1", "2"])
...:
Out[3]: array(['1', '2'], dtype='<U1')
In [4]: np.array(["1", "2"], dtype='int')
Out[4]: array([1, 2]) This test suggests that 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 |
||
|
||
if issubclass(data.dtype.type, str): | ||
cls._string_data_error(data) | ||
|
Uh oh!
There was an error while loading. Please reload this page.