Skip to content

Commit 8cad257

Browse files
DGradyDaniel Grady
authored and
Daniel Grady
committed
Test expected behavior for argmax/min with infinite values
1 parent 706a86a commit 8cad257

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/series/test_operators.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,3 +1857,15 @@ def test_op_duplicate_index(self):
18571857
result = s1 + s2
18581858
expected = pd.Series([11, 12, np.nan], index=[1, 1, 2])
18591859
assert_series_equal(result, expected)
1860+
1861+
def test_argminmax(self):
1862+
# GH13595
1863+
1864+
# Expected behavior for arg min/max in the presence of NA and Inf
1865+
s = pd.Series([0, -np.inf, np.inf, np.nan])
1866+
1867+
assert s.argmin() == 1
1868+
assert np.isnan(s.argmin(skipna=False))
1869+
1870+
assert s.argmax() == 2
1871+
assert np.isnan(s.argmax(skipna=False))

0 commit comments

Comments
 (0)