Skip to content

Commit 0d07c23

Browse files
authored
TST: Add a test for series name should be preserved in pser.mode() (#46746)
* Add a test for Series.name preserved in ser.mode * Address comments
1 parent f976aa6 commit 0d07c23

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tests/test_algos.py

+7
Original file line numberDiff line numberDiff line change
@@ -2282,6 +2282,13 @@ def test_index(self):
22822282
# algos.mode expects Arraylike, does *not* unwrap TimedeltaIndex
22832283
algos.mode(idx)
22842284

2285+
def test_ser_mode_with_name(self):
2286+
# GH 46737
2287+
ser = Series([1, 1, 3], name="foo")
2288+
result = ser.mode()
2289+
expected = Series([1], name="foo")
2290+
tm.assert_series_equal(result, expected)
2291+
22852292

22862293
class TestDiff:
22872294
@pytest.mark.parametrize("dtype", ["M8[ns]", "m8[ns]"])

0 commit comments

Comments
 (0)