|
12 | 12 | from pandas import DataFrame, Index, Series, Timestamp
|
13 | 13 | from pandas.compat import lrange
|
14 | 14 |
|
15 |
| -from pandas.core.base import FrozenList |
16 |
| - |
17 | 15 | from pandas.tests.frame.common import TestData
|
18 | 16 |
|
19 | 17 | import pandas.util.testing as tm
|
20 | 18 | from pandas.util.testing import (assertRaisesRegexp,
|
21 |
| - assert_equal, |
22 | 19 | assert_frame_equal,
|
23 | 20 | assert_series_equal)
|
24 | 21 |
|
@@ -329,14 +326,18 @@ def test_join_multiindex_leftright(self):
|
329 | 326 |
|
330 | 327 | def test_concat_named_keys(self):
|
331 | 328 | # GH 14252
|
332 |
| - df = DataFrame({'foo': [1, 2, 3, 4], |
333 |
| - 'bar': [0.1, 0.2, 0.3, 0.4]}) |
| 329 | + df = pd.DataFrame({'foo': [1, 2], 'bar': [0.1, 0.2]}) |
| 330 | + df_concatted = pd.DataFrame( |
| 331 | + {'foo': [1, 2, 1, 2], 'bar': [0.1, 0.2, 0.1, 0.2]}, |
| 332 | + index=pd.MultiIndex.from_product((['a', 'b'], [0, 1]), |
| 333 | + names=['baz', None])) |
334 | 334 | index = Index(['a', 'b'], name='baz')
|
335 | 335 | concatted_named_from_keys = pd.concat([df, df], keys=index)
|
336 |
| - assert_equal(concatted_named_from_keys.index.names, FrozenList(['baz', None])) |
| 336 | + assert_frame_equal(concatted_named_from_keys, df_concatted) |
337 | 337 | index_no_name = ['a', 'b']
|
338 |
| - concatted_named_from_names = pd.concat([df, df], keys=index_no_name, names=['baz']) |
339 |
| - assert_equal(concatted_named_from_names.index.names, FrozenList(['baz', None])) |
| 338 | + concatted_named_from_names = pd.concat( |
| 339 | + [df, df], keys=index_no_name, names=['baz']) |
| 340 | + assert_frame_equal(concatted_named_from_names, df_concatted) |
340 | 341 |
|
341 | 342 |
|
342 | 343 | class TestDataFrameCombineFirst(tm.TestCase, TestData):
|
|
0 commit comments