Skip to content

Commit 757a3b4

Browse files
DGradyDaniel Grady
authored and
Daniel Grady
committed
Update expected behavior of groupby.idxmax with strings
Previously, Series.idxmax with string data raised a ValueError, due to an attempt to coerce the strings to floats in the `nanops` module. DataFrame.groupby.idxmax would consequently drop columns containing string data.
1 parent 8cad257 commit 757a3b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/tests/groupby/test_groupby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,7 @@ def test_non_cython_api(self):
23392339
assert_frame_equal(result, expected)
23402340

23412341
# idxmax
2342-
expected = DataFrame([[0], [nan]], columns=['B'], index=[1, 3])
2342+
expected = DataFrame([[0.0, 0.0], [nan, 2.0]], columns=['B', 'C'], index=[1, 3])
23432343
expected.index.name = 'A'
23442344
result = g.idxmax()
23452345
assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)