-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
API: implement __array_function__ for ExtensionArray #35032
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
Closed
simonjayhawkins
wants to merge
30
commits into
pandas-dev:master
from
simonjayhawkins:__array_function__
Closed
Changes from 26 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
7fe754e
wip
simonjayhawkins d41d136
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins cc57254
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins 0c515e4
add tests for np.tile and SparseArray specific implementation
simonjayhawkins aef535c
add IS_NEP18_ACTIVE and skip_if_no_nep18 test decorator
simonjayhawkins ed2962d
fix failing tests (tests/arrays and tests/extension)
simonjayhawkins cd161ad
mypy fixup
simonjayhawkins 34afe27
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins 5ca65e1
add np.vstack (dispatches back to NumPy)
simonjayhawkins f347243
remove np.tile implementation for now to reduce diff
simonjayhawkins 009ac61
and remove _tile_1d
simonjayhawkins 584ccf2
don't dispatch to EA.unique from np.unique
simonjayhawkins 72e4477
lint fixup
simonjayhawkins 807aae8
fix test_fillna_null for IntervalIndex
simonjayhawkins 9621c25
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins ffab382
test from 35038 to get ci to green
simonjayhawkins 0255671
add ArrayFunctionMixin
simonjayhawkins 7b379f4
remove ArrayFunctionMixin unintentially added to BaseMaskedDtype
simonjayhawkins 96db577
revert changes to pandas/core/arrays/numpy_.py
simonjayhawkins d8b1a8b
Revert "revert changes to pandas/core/arrays/numpy_.py"
simonjayhawkins 61c53f5
add ArrayFunctionMixin to NDArrayBackedExtensionArray and reinstate P…
simonjayhawkins 39ae5f9
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins 0e27746
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins d7f4550
reduce diff
simonjayhawkins 577010f
refactor condition
simonjayhawkins bc3f4e1
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins d8af2fc
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins 3843481
amin, amax to NDArrayBackedExtensionArray
simonjayhawkins 20c7328
Merge remote-tracking branch 'upstream/master' into __array_function__
simonjayhawkins 7b9fab5
concat_compat raises numpy.AxisError with axis=1
simonjayhawkins 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
import pandas.util._test_decorators as td | ||
|
||
import pandas as pd | ||
|
||
from .base import BaseExtensionTests | ||
|
||
|
||
@td.skip_if_no_nep18 | ||
class BaseNumpyArrayFunctionTests(BaseExtensionTests): | ||
def test_concatenate(self, data): | ||
expected = pd.array(list(data) * 3, dtype=data.dtype) | ||
|
||
result = np.concatenate([data] * 3) | ||
self.assert_extension_array_equal(result, expected) | ||
|
||
result = np.concatenate([data] * 3, axis=0) | ||
self.assert_extension_array_equal(result, expected) | ||
|
||
msg = "axis 1 is out of bounds for array of dimension 1" | ||
with pytest.raises(np.AxisError, match=msg): | ||
np.concatenate([data] * 3, axis=1) | ||
|
||
def test_ndim(self, data): | ||
assert np.ndim(data) == 1 | ||
|
||
def test_vstack(self, data): | ||
expected = np.array([data.to_numpy()] * 2) | ||
result = np.vstack([data, data]) | ||
self.assert_numpy_array_equal(result, expected) |
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
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
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
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
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.