-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Add argmax and argmin to ExtensionArray #27801
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
8303674
44838f7
8bc9573
bc69a4a
4787c63
8bd82f5
e84268b
f9c9fea
8b7585f
41e8ce4
20ca0a2
1aa7422
f2b6958
7d81cc5
d18c8bb
3530a6a
8d8506a
e7e7c86
10f9b27
ccded0b
9aea8fe
5636d2a
4db39e0
2036b25
d81a8f8
58d46d0
6b88790
8cd7169
810ac56
6b030aa
e5a6d8c
d7a49c1
65e1e4c
1b64e2f
2cdf16b
7c79f5c
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 |
---|---|---|
|
@@ -53,6 +53,16 @@ def test_from_sequence_from_cls(self, data): | |
|
||
|
||
class TestReduce(base.BaseNoReduceTests): | ||
@pytest.mark.parametrize("skipna", [True, False]) | ||
def test_reduce_series_numeric(self, data, all_numeric_reductions, skipna): | ||
op_name = all_numeric_reductions | ||
TomAugspurger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if op_name in ("max", "min"): | ||
pass | ||
else: | ||
ser = pd.Series(data) | ||
with pytest.raises(TypeError): | ||
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. Error message? 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. Thanks for your review. 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 think @gfyoung was asking that you assert something about the error message with 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. Those functions just raise the |
||
getattr(ser, op_name)(skipna=skipna) | ||
|
||
def test_reduce_series_boolean(self): | ||
pass | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,6 +195,14 @@ def test_searchsorted(self, data_for_sorting): | |
if not data_for_sorting.ordered: | ||
raise pytest.skip(reason="searchsorted requires ordered data.") | ||
|
||
def test_max(self): | ||
# GH 24382 | ||
pass | ||
|
||
def test_min(self): | ||
# GH 24382 | ||
pass | ||
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. How come these are empty? 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 methods added in this PR ignore nan ,i.e., If 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. We don't want a release where these become out of sync, so perhaps a PR implementing |
||
|
||
|
||
class TestCasting(base.BaseCastingTests): | ||
pass | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,6 +246,20 @@ def test_repeat(self, data, repeats, as_series, use_numpy): | |
# Fails creating expected | ||
super().test_repeat(data, repeats, as_series, use_numpy) | ||
|
||
def test_max(self): | ||
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. Do the base tests not work here? |
||
# GH 24382 | ||
data = PandasArray(np.array([1, np.nan, 0])) | ||
result = data.max() | ||
expected = data[0] | ||
assert result == expected | ||
|
||
def test_min(self): | ||
# GH 24382 | ||
data = PandasArray(np.array([1, np.nan, 0])) | ||
result = data.min() | ||
expected = data[2] | ||
assert result == expected | ||
|
||
|
||
@skip_nested | ||
class TestArithmetics(BaseNumPyTests, base.BaseArithmeticOpsTests): | ||
|
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 move this to 1.0.0 now?