-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
ENH: Integer NA Extension Array #21160
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4586245
ENH: add integer-na support via an ExtensionArray
jreback 4faa4c6
update for review comments
jreback 712b52d
update docs of IntegerDtype
jreback 74f392a
review comments
jreback 3889feb
make data & mask private attributes
jreback e5b8641
add dtype to to_integer_array
jreback d073e57
remove uneeded code & copies
jreback 2f08181
handle numpy scalars & more tests
jreback e6533dd
clean up / test astype
jreback 35a8738
fix up dtype comparison tests
jreback 68efb02
fixup quotes in interval index error messages
jreback c9e8f7d
some optimization on dtype checking
jreback ec2c632
don't force repr on invalid dtype
jreback 953de12
remove uneeded try/catch; review comments
jreback e74d10b
only allow safe casting
jreback 23afee1
review comments
jreback 86362f6
xfail reduce ops
jreback 1bdeb18
better type checking for extension types
jreback 8885835
use a better testing idiom
jreback 3dbb378
Merge branch 'master' into intna
jreback 1606786
interval index compat
jreback e9e0937
Merge branch 'master' into intna
jreback 4f04f90
Merge branch 'master' into intna
jreback File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update for review comments
- Loading branch information
commit 4faa4c6a20db3c35d487b462f85c025a9a6f3ea0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -311,7 +311,7 @@ def _concat_same_type(cls, to_concat): | |
return cls(data, mask=mask, dtype=to_concat[0].dtype) | ||
|
||
def astype(self, dtype, copy=True): | ||
"""Cast to a NumPy array with 'dtype'. | ||
"""Cast to a NumPy array or IntegerArray with 'dtype'. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -324,8 +324,8 @@ def astype(self, dtype, copy=True): | |
|
||
Returns | ||
------- | ||
array : ndarray | ||
NumPy ndarray with 'dtype' for its dtype. | ||
array : ndarray or IntegerArray | ||
NumPy ndarray or IntergerArray with 'dtype' for its dtype. | ||
|
||
Raises | ||
------ | ||
|
@@ -502,7 +502,8 @@ def integer_arithmetic_method(self, other): | |
if isinstance(other, IntegerArray): | ||
other, mask = other.data, other.mask | ||
elif getattr(other, 'ndim', 0) > 1: | ||
raise TypeError("can only perform ops with 1-d structures") | ||
raise NotImplementedError( | ||
"can only perform ops with 1-d structures") | ||
elif is_list_like(other): | ||
other = np.asarray(other) | ||
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 try to convert to IntegerArray here if possible? |
||
if not other.ndim: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you specify when what is returned?