Can HDF5 tables be used by different versions of pandas than what they were created on?

StackOverflow https://stackoverflow.com/questions/22977601

  •  30-06-2023
  •  | 
  •  

문제

I have a pandas dataframe stored in a .h5 file. I wanted to work on the data on my home machine, so I copied it onto my laptop. To my surprise, I was unable to load the dataframe, though the table loaded without incident. Moreover, when I printed the .h5 file on the machine it was made on (with pandas 0.13.0), I got the following result:

File path: wavefunction_file_key_2000.wfn.npy.h5
/wavefunction            frame        (shape->[1478,10001])

But on the other machine (pandas 0.7.0), it was:

File path: wavefunction_file_key_2000.wfn.npy.h5
wavefunction     DataFrame

Is the shape information lost when the file is copied between computers? Or are different versions of HDF5 incompatible?

도움이 되었습니까?

해결책

They should be compatible even across platforms / HDF versions.

You should be able to read even a very old version with a pandas versions >= 0.10.1 (when the newer format stabilized)

However it is not possible to read a newer version (your top print) with a pre-0.10.1 version of pandas (the bottom print).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top