Skip to content

Commit 8c08cd5

Browse files
author
Robin
committed
Added multi-test and whatsnew note
1 parent 5f36395 commit 8c08cd5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/source/whatsnew/v0.20.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -924,3 +924,4 @@ Bug Fixes
924924
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`)
925925
- Bug in ``.eval()`` which caused multiline evals to fail with local variables not on the first line (:issue:`15342`)
926926
- Bug in ``pd.read_msgpack`` which did not allow to load dataframe with an index of type ``CategoricalIndex`` (:issue:`15487`)
927+
- Bug in ``.mode()`` where ``mode`` was not returned for a single value (:issue:`15714`)

pandas/tests/test_algos.py

+7
Original file line numberDiff line numberDiff line change
@@ -1261,11 +1261,18 @@ def test_mode_single(self):
12611261
exp_single = [1]
12621262
data_single = [1]
12631263

1264+
exp_multi = [1]
1265+
data_multi = [1, 1]
1266+
12641267
for dt in np.typecodes['AllInteger'] + np.typecodes['Float']:
12651268
s = Series(data_single, dtype=dt)
12661269
exp = Series(exp_single, dtype=dt)
12671270
tm.assert_series_equal(algos.mode(s), exp)
12681271

1272+
s = Series(data_multi, dtype=dt)
1273+
exp = Series(exp_multi, dtype=dt)
1274+
tm.assert_series_equal(algos.mode(s), exp)
1275+
12691276
exp = Series([1], dtype=np.int)
12701277
tm.assert_series_equal(algos.mode([1]), exp)
12711278

0 commit comments

Comments
 (0)