6
$\begingroup$

I work with colleagues who rely on HDF5 as their data interchange format (largely exported from Python's Pandas).

Of course we have Import[] available for getting this data in, but I would like to work with it in the Dataset[] idiom. I was disappointed to see that SemanticImport[] doesn't do the job I'd expect here. (You'd sort of hope / expect that importing a "Dataset" would, well, map to a Dataset, but such are the ways of WRI).

I know I can 'assemble' the Dataset from the HDF5 in a straight-forward way, but was just wondering if anyone had already done the 'heavy lifting' here.

$\endgroup$
  • 1
    $\begingroup$ In this answer I have a section on HDF5, which is based on Import / Export. This may not be entirely what you are after, but might still be useful. The code I gave there converts between HDF and a tabular list structure, but I also provided functions tableToDataset and datasetToTable which you can use to convert between Dataset and HDF5, so you will have to use tableToDataset @* hdf5ToTable and datasetToTable @* tableToHDF5. $\endgroup$ – Leonid Shifrin Sep 25 '15 at 16:45
  • $\begingroup$ @LeonidShifrin Beautiful, I will have a look. Your code is seemingly always useful. $\endgroup$ – flip Sep 25 '15 at 16:51
  • $\begingroup$ A followup to the above, in case someone comes looking - Lots of the data I'm getting has so-called Compound data. Mathematica (still) doesn't play nice with compound data, and a few of the custom-whipped MathLink (now called something else) solutions don't seem to like what I have either. So, for now, if you're exchanging Compound data, beware. $\endgroup$ – flip Oct 1 '15 at 17:55
3
$\begingroup$

You can see:

https://github.com/scotmartin1234/HDF5Mathematica

There are some screenshots about compound datatypes, and you could also download the package and use it.

This is version 2.00 (August 2016) of the package that was originally provided as version 1.00 in July 2011.

$\endgroup$
  • 1
    $\begingroup$ It would be better if instead of posting the exact same thing on a number of different answers, you could tailor each answer to demonstrate how your package works for that particular question. Otherwise, this is rather unproductive. $\endgroup$ – J. M. will be back soon Aug 19 '16 at 8:39
  • $\begingroup$ Quick note for others looking at this answer, it is, apparently, Windows only and the Github distribution seems to include compiled DLLs and not any source. $\endgroup$ – flip Aug 21 '16 at 17:45
  • $\begingroup$ Hi Flip: Mathematica package interfaces between Mathematica and P/Invoke. So: (1) Correct: what is on GitHub includes only Windows DLL. (2) Possible: someone who is good with C can get P/Invoke and other source from HDF group and then compile on Mac and Unix. P/Invoke works in Mac and Unix environments when compiled. An expert "C" user could probably get this to work without too much problem since it's just "compile on my machine". In this case, you'd be all set on Mac or Unix, too. (3)Comment about absence of source is not correct: all Mathematica code is on Gihub; "C" source is on HDF group. $\endgroup$ – ScotMartin Aug 21 '16 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.