Skip to content

Commit e9561fe

Browse files
Refactoring test case code for orderedDict and improving whatsnew info. #21510
1 parent 6869e2c commit e9561fe

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

doc/source/whatsnew/v0.23.2.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ Bug Fixes
8383
**Other**
8484

8585
- Bug in :meth:`Series.nlargest` for signed and unsigned integer dtypes when the minimum value is present (:issue:`21426`)
86-
- Bug in :class:`_Concatenator` should maintain dict ordering when :meth:`concat` is called (:issue:`2151`)
86+
- Bug in :meth:`concat` should maintain dict ordering when :meth:`concat` is called (:issue:`2151`)
8787
-

pandas/tests/reshape/test_concat.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1299,11 +1299,10 @@ def test_concat_with_ordered_dict(self):
12991299
# GH 21510
13001300
result = pd.concat(OrderedDict([('First', pd.Series(range(3))),
13011301
('Another', pd.Series(range(4)))]))
1302-
a = pd.Series(range(3), range(3))
1303-
b = pd.Series(range(4), range(4))
1304-
a.index = pd.MultiIndex.from_tuples([('First', v) for v in a.index])
1305-
b.index = pd.MultiIndex.from_tuples([('Another', v) for v in b.index])
1306-
expected = a.append(b)
1302+
index = MultiIndex(levels=[['First', 'Another'], [0, 1, 2, 3]],
1303+
labels=[[0, 0, 0, 1, 1, 1, 1], [0, 1, 2, 0, 1, 2, 3]])
1304+
data = list(range(3)) + list(range(4))
1305+
expected = pd.Series(data,index=index)
13071306
tm.assert_series_equal(result, expected)
13081307

13091308
def test_crossed_dtypes_weird_corner(self):

0 commit comments

Comments
 (0)