Skip to content

Commit 6211936

Browse files
committed
BUG: reading non-well formed generic_tables not working (e.g. detector/readout), where readout is a table
added pytables_native2.h5 for testing BUG: force travis to rebuild BUG: fix travis build 2
1 parent 71d5151 commit 6211936

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

pandas/core/reshape.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,5 +834,5 @@ def block2d_to_blocknd(values, items, shape, labels, ref_items=None):
834834

835835
def factor_indexer(shape, labels):
836836
""" given a tuple of shape and a list of Factor lables, return the expanded label indexer """
837-
mult = np.array(shape, dtype = 'i8')[::-1].cumprod()[::-1]
838-
return np.sum(np.array(labels, dtype = 'i8').T * np.append(mult, [1]), axis=1).T
837+
mult = np.array(shape)[::-1].cumprod()[::-1]
838+
return (np.sum(np.array(labels).T * np.append(mult, [1]), axis=1).T).astype('i8')

pandas/io/pytables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ def create_table_index(self, key, **kwargs):
612612
def groups(self):
613613
""" return a list of all the top-level nodes (that are not themselves a pandas storage object) """
614614
_tables()
615-
return [ g for g in self.handle.walkGroups() if getattr(g._v_attrs,'pandas_type',None) or getattr(g,'table',None) or isinstance(g,_table_mod.table.Table) ]
615+
return [ g for g in self.handle.walkNodes() if getattr(g._v_attrs,'pandas_type',None) or getattr(g,'table',None) or (isinstance(g,_table_mod.table.Table) and g._v_name != 'table') ]
616616

617617
def get_node(self, key):
618618
""" return the node with the key or None if it does not exist """

pandas/io/tests/pytables_native.h5

60.5 KB
Binary file not shown.

pandas/io/tests/pytables_native2.h5

12 KB
Binary file not shown.

pandas/io/tests/test_pytables.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ def test_big_table_panel(self):
754754
x = time.time()
755755
try:
756756
store = HDFStore(self.scratchpath)
757-
store.prof_append('wp', wp)
757+
store.append('wp', wp)
758758
rows = store.root.wp.table.nrows
759759
recons = store.select('wp')
760760
finally:
@@ -1748,9 +1748,11 @@ def _check_roundtrip_table(self, obj, comparator, compression=False):
17481748
def test_pytables_native_read(self):
17491749
pth = curpath()
17501750
store = HDFStore(os.path.join(pth, 'pytables_native.h5'), 'r')
1751+
d2 = store['detector/readout']
1752+
store.close()
1753+
store = HDFStore(os.path.join(pth, 'pytables_native2.h5'), 'r')
1754+
str(store)
17511755
d1 = store['detector']
1752-
d2 = store['detector/table']
1753-
assert_frame_equal(d1, d2)
17541756
store.close()
17551757

17561758
def test_legacy_read(self):
@@ -1826,7 +1828,7 @@ def do_copy(f = None, new_f = None, keys = None, propindexes = True, **kwargs):
18261828
if a.is_indexed:
18271829
self.assert_(new_t[a.name].is_indexed == True)
18281830

1829-
except:
1831+
except (Exception), detail:
18301832
pass
18311833
finally:
18321834
store.close()

0 commit comments

Comments
 (0)