-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Fixing shift() for ExtensionArray #23947
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 10 commits
7ff05e7
532436e
6584dca
abba682
172545a
67c268d
b0c13e4
acecc2a
e5b7ebc
eb4eea9
d659404
31a9cc8
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 |
---|---|---|
|
@@ -39,6 +39,14 @@ class TestInterface(BaseArrowTests, base.BaseInterfaceTests): | |
def test_repr(self, data): | ||
raise pytest.skip("TODO") | ||
|
||
def test_shift_non_empty_array(self, data): | ||
raise pytest.skip("Skipping because the implementation of" | ||
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. is there an issue for this? 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'll check through the issues list and update in a while. But the reason I added this is @ TomAugspurger's recommendation above.
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 you add an issue for this |
||
"`ArrowBoolArray` is quite buggy.") | ||
|
||
def test_shift_empty_array(self, data): | ||
raise pytest.skip("Skipping because the implementation of" | ||
"`ArrowBoolArray` is quite buggy.") | ||
|
||
|
||
class TestConstructors(BaseArrowTests, base.BaseConstructorsTests): | ||
def test_from_dtype(self, data): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from pandas.compat import StringIO | ||
|
||
|
@@ -86,3 +87,25 @@ def test_isna_extension_array(self, data_missing): | |
assert not na.all() | ||
|
||
assert na.dtype._is_boolean | ||
|
||
@pytest.mark.parametrize('periods, indices', [ | ||
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 would move this to methods.py I think (and obviously move the overrides in arrow as well) 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. Since moving this to methods takes it out of the 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. see my comment below |
||
[-4, [-1, -1]], | ||
[-1, [1, -1]], | ||
[0, [0, 1]], | ||
[1, [-1, 0]], | ||
[4, [-1, -1]] | ||
]) | ||
def test_shift_non_empty_array(self, data, periods, indices): | ||
subset = data[:2] | ||
result = subset.shift(periods) | ||
expected = subset.take(indices, allow_fill=True) | ||
self.assert_extension_array_equal(result, expected) | ||
|
||
@pytest.mark.parametrize('periods', [ | ||
-4, -1, 0, 1, 4 | ||
]) | ||
def test_shift_empty_array(self, data, periods): | ||
empty = data[:0] | ||
result = empty.shift(periods) | ||
expected = empty | ||
self.assert_extension_array_equal(result, expected) |
Uh oh!
There was an error while loading. Please reload this page.