Skip to content

Commit

Permalink
Improving test case for orderedDict and whatsnew info. pandas-dev#21510
Browse files Browse the repository at this point in the history
  • Loading branch information
SaturninoMateus committed Jun 17, 2018
1 parent eaa7cc0 commit 6869e2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.23.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ Bug Fixes
**Other**

- Bug in :meth:`Series.nlargest` for signed and unsigned integer dtypes when the minimum value is present (:issue:`21426`)
- Bug in :class:`_Concatenator` should not sort Ordered Dictionaries (:issue:`21510`)
- Bug in :class:`_Concatenator` should maintain dict ordering when :meth:`concat` is called (:issue:`2151`)
-
15 changes: 8 additions & 7 deletions pandas/tests/reshape/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1297,13 +1297,14 @@ def test_concat_rename_index(self):

def test_concat_with_ordered_dict(self):
# GH 21510
ps = pd.concat(OrderedDict([('First', pd.Series(range(3))),
('Another', pd.Series(range(4)))]))
ps_list = list(ps.keys())
exp_list = [('First', 0), ('First', 1), ('First', 2),
('Another', 0), ('Another', 1),
('Another', 2), ('Another', 3)]
assert ps_list == exp_list
result = pd.concat(OrderedDict([('First', pd.Series(range(3))),
('Another', pd.Series(range(4)))]))
a = pd.Series(range(3), range(3))
b = pd.Series(range(4), range(4))
a.index = pd.MultiIndex.from_tuples([('First', v) for v in a.index])
b.index = pd.MultiIndex.from_tuples([('Another', v) for v in b.index])
expected = a.append(b)
tm.assert_series_equal(result, expected)

def test_crossed_dtypes_weird_corner(self):
columns = ['A', 'B', 'C', 'D']
Expand Down

0 comments on commit 6869e2c

Please sign in to comment.