Skip to content

Commit 3bf6a46

Browse files
committed
BUG: fix #2299?
1 parent bd54c9e commit 3bf6a46

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/io/pytables.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,9 @@ def _write_block_manager(self, group, data):
509509
group._v_attrs.nblocks = nblocks
510510
for i in range(nblocks):
511511
blk = data.blocks[i]
512-
self._write_index(group, 'block%d_items' % i, blk.items)
512+
# I have no idea why, but writing values before items fixed #2299
513513
self._write_array(group, 'block%d_values' % i, blk.values)
514+
self._write_index(group, 'block%d_items' % i, blk.items)
514515

515516
def _read_block_manager(self, group):
516517
ndim = group._v_attrs.ndim
@@ -697,6 +698,7 @@ def _write_array(self, group, key, value):
697698
# Transform needed to interface with pytables row/col notation
698699
empty_array = any(x == 0 for x in value.shape)
699700
transposed = False
701+
700702
if not empty_array:
701703
value = value.T
702704
transposed = True

0 commit comments

Comments
 (0)