HDF5 data set, unable to read contents

dieter dieter at handshake.de
Fri Mar 11 04:37:37 EST 2016


varun7rs at gmail.com writes:

> I recently came across a package called matrix2latex which simplifies the creation of very large tables. So, I saved my data in .mat format using the '-v7.3' extension so that they can be read by python.
>
> Now, when I try to read these files, I'm having some problems in reproducing the whole matrix. Whenever I try and print out an element of the array, I only get 'HDF5 object reference' as the output.

"print" implicitely converts an object to a string.
As there are a huge number of potential object types, "print" itself
cannot know all the relevant details regarding string convertion for
all types -- each individual type must help (by defining
"__str__" and/or "__repr__"). If it does not help, you
get a printout as the above.

In an interactive Python session, you can use "help(...)" on
one of those "HDF5 object reference"s. This will show you the
API of the object - i.e. how to interact with the object
(such as accessing/modifying the contained information).
"vars(...)" may also help (it shows the object's (instance) attributes).




More information about the Python-list mailing list