Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix legacy hdf5 loading #424

Open
ljchang opened this issue Dec 11, 2023 · 1 comment
Open

Fix legacy hdf5 loading #424

ljchang opened this issue Dec 11, 2023 · 1 comment
Assignees

Comments

@ljchang
Copy link
Member

ljchang commented Dec 11, 2023

@ejolly, just tried using the new hdf5 loading for an older file and encoutered this error message:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[33], line 16
     12 f = file_list[0]
     14 sub = os.path.basename(f).split('_')[0]
---> 16 fmri_data = Brain_Data(f)

File ~/Github/nltools/nltools/data/brain_data.py:206, in Brain_Data.__init__(self, data, Y, X, mask, **kwargs)
    203 else:
    204     # Load X and Y dataframes
    205     with pd.HDFStore(to_load, "r") as f:
--> 206         self.X = f["X"]
    207         self.Y = f["Y"]
    209     # Load data and masker stuffs

File ~/opt/anaconda3/lib/python3.11/site-packages/pandas/io/pytables.py:602, in HDFStore.__getitem__(self, key)
    601 def __getitem__(self, key: str):
--> 602     return self.get(key)

File ~/opt/anaconda3/lib/python3.11/site-packages/pandas/io/pytables.py:813, in HDFStore.get(self, key)
    811 if group is None:
    812     raise KeyError(f"No object named {key} in the file")
--> 813 return self._read_group(group)

File ~/opt/anaconda3/lib/python3.11/site-packages/pandas/io/pytables.py:1878, in HDFStore._read_group(self, group)
   1877 def _read_group(self, group: Node):
-> 1878     s = self._create_storer(group)
   1879     s.infer_axes()
   1880     return s.read()

File ~/opt/anaconda3/lib/python3.11/site-packages/pandas/io/pytables.py:1752, in HDFStore._create_storer(self, group, format, value, encoding, errors)
   1750         tt = "generic_table"
   1751     else:
-> 1752         raise TypeError(
   1753             "cannot create a storer if the object is not existing "
   1754             "nor a value are passed"
   1755         )
   1756 else:
   1757     if isinstance(value, Series):

TypeError: cannot create a storer if the object is not existing nor a value are passed

I don't believe there should be any metadata stored in these files. Is this something is simple as just checking and initializing with an empty value?

@ljchang
Copy link
Member Author

ljchang commented May 2, 2024

@ejolly , I know @nirjacoby has also encountered this issue. Let us know if there is anything we can do to help fix it. It might make sense for you to take the lead on this one.

@ejolly ejolly changed the title loading legacy hdf5 files Fix legacy hdf5 loading Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants