Skip to content

Commit

Permalink
better try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Feb 19, 2025
1 parent 551b56e commit f68969c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/hdmf/common/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,21 @@ def get(self, arg, **kwargs):
# When len(indices) == 0, ret is expected to be an empty list, defined above.
try:
data = self.target.get(slice(None), **kwargs)
slices = [self.__get_slice(i) for i in indices]
if isinstance(data, pd.DataFrame):
ret = [data.iloc[s] for s in slices]
else:
ret = [data[s] for s in slices]
except IndexError:
"""
Note: TODO: test_to_hierarchical_dataframe_indexed_dtr_on_last_level.
This is the old way to get the data and not an untested feature.
"""
for i in indices:
ret.append(self.__getitem_helper(i, **kwargs))

return ret

slices = [self.__get_slice(i) for i in indices]
if isinstance(data, pd.DataFrame):
ret = [data.iloc[s] for s in slices]
else:
ret = [data[s] for s in slices]
return ret


Expand Down

0 comments on commit f68969c

Please sign in to comment.