-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
ENH: NumericIndex for any numpy int/uint/float dtype #41153
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
9739f85
88a7858
7ccb1b7
b45500d
5ef35f5
d8f6c22
1c65a0b
f3e13aa
4e17485
c1e801d
aa0cea7
1f5f922
132ce44
058cd2e
1c7f23f
07a097c
ff6cfb4
fe7b97c
86f3960
2424c0d
a515bba
341fc2f
c2d8884
5a56b1a
a497d57
6557689
5bc4c2c
84bf540
69953b4
b4be77d
bb42e2d
bafa9b3
35b0e71
ed4730b
6a32788
47e208c
d6a03a0
ec003ed
7ddee71
2bb282f
c1633fb
9c7d57b
f6dccc1
3630fc7
bfe6895
8532ddb
186de8e
ead8f57
2a850ea
d04da70
4b8385c
1f52f8b
951c5f7
7c7c0dd
bb72c68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,7 +283,7 @@ def _is_dtype_compat(self, other) -> Categorical: | |
|
|
||
| @doc(Index.astype) | ||
| def astype(self, dtype, copy: bool = True) -> Index: | ||
| from pandas.core.api import NumIndex | ||
| from pandas.core.api import NumericIndex | ||
|
Member
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. can annotate dtype as Dtype
Contributor
Author
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. Ok.
Member
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. should we change/deprecate Index.astype(np.int32), also Index(foo, dtype=np.int32)?
Contributor
Author
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. Hmm,
Member
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. doing that as a follow-up sounds good |
||
|
|
||
| dtype = pandas_dtype(dtype) | ||
|
|
||
|
|
@@ -292,7 +292,7 @@ def astype(self, dtype, copy: bool = True) -> Index: | |
| # but if e.g. the categories are a NumIndex with dtype float32, we want to | ||
| # return an index with the same dtype as self.categories. | ||
| if cat._is_num_index(): | ||
| assert isinstance(cat, NumIndex) # mypy complaint fix | ||
| assert isinstance(cat, NumericIndex) # mypy complaint fix | ||
| try: | ||
| cat._validate_dtype(dtype) | ||
| except ValueError: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.