Skip to content

Commit 441e8d5

Browse files
committed
TST: ensure that MultIIndex names are stored correctly
1 parent 3e98b72 commit 441e8d5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pandas/io/tests/test_pytables.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,25 @@ def test_store_hierarchical(self):
180180
index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'],
181181
['one', 'two', 'three']],
182182
labels=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3],
183-
[0, 1, 2, 0, 1, 1, 2, 0, 1, 2]])
183+
[0, 1, 2, 0, 1, 1, 2, 0, 1, 2]],
184+
names=['foo', 'bar'])
184185
frame = DataFrame(np.random.randn(10, 3), index=index,
185186
columns=['A', 'B', 'C'])
186187

187188
self._check_roundtrip(frame, tm.assert_frame_equal)
188189
self._check_roundtrip(frame.T, tm.assert_frame_equal)
189190
self._check_roundtrip(frame['A'], tm.assert_series_equal)
190191

192+
# check that the
193+
try:
194+
store = HDFStore(self.scratchpath)
195+
store['frame'] = frame
196+
recons = store['frame']
197+
assert(recons.index.names == ['foo', 'bar'])
198+
finally:
199+
store.close()
200+
os.remove(self.scratchpath)
201+
191202
def test_store_mixed(self):
192203
def _make_one():
193204
df = tm.makeDataFrame()

0 commit comments

Comments
 (0)