diff --git a/pandas/tools/tests/test_merge.py b/pandas/tools/tests/test_merge.py index 3964a04d21433..ec8212db5afcb 100644 --- a/pandas/tools/tests/test_merge.py +++ b/pandas/tools/tests/test_merge.py @@ -1427,6 +1427,36 @@ def df(): # it works! concat([ panel1, panel3 ], axis = 1, verify_integrity = True) + def test_panel4d_concat(self): + p4d = tm.makePanel4D() + + p1 = p4d.ix[:, :, :5, :] + p2 = p4d.ix[:, :, 5:, :] + + result = concat([p1, p2], axis=2) + tm.assert_panel4d_equal(result, p4d) + + p1 = p4d.ix[:, :, :, :2] + p2 = p4d.ix[:, :, :, 2:] + + result = concat([p1, p2], axis=3) + tm.assert_panel4d_equal(result, p4d) + + def test_panel4d_concat_mixed_type(self): + p4d = tm.makePanel4D() + + # if things are a bit misbehaved + p1 = p4d.ix[:, :2, :, :2] + p2 = p4d.ix[:, :, :, 2:] + p1['L5'] = 'baz' + + result = concat([p1, p2], axis=3) + + expected = p4d.copy() + expected['L5'] = expected['L5'].astype('O') + expected.ix['L5', :, :, :2] = 'baz' + tm.assert_panel4d_equal(result, expected) + def test_concat_series(self): ts = tm.makeTimeSeries() ts.name = 'foo'