# Parse user uploaded hdf5?

**URL:** <https://community.plotly.com/t/parse-user-uploaded-hdf5/11311>\
**Category:** Dash Python\
**Created:** [June 28, 2018, 4:59pm UTC](https://community.plotly.com/t/parse-user-uploaded-hdf5/11311 "2018-06-28T16:59:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amiralavi](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/amiralavi/32/3484_2.png) [@amiralavi](https://community.plotly.com/u/amiralavi)\
**Post date:** [June 28, 2018, 4:59pm UTC](https://community.plotly.com/t/parse-user-uploaded-hdf5/11311/1 "2018-06-28T16:59:03Z")

</div>

I’m building a Dash web app that needs to allow a user to upload some of their own data. Due to previous versions of this web app (not built with Dash), we require users to upload “.hdf5” binary files, which have a pandas DataFrame stored under an agreed-upon key.

I’m looking at the tutorials for how to use the Upload component, and I want to store the dataframe as a DataTable in a hidden Div component (so that the data can be shared with other callbacks).

However, I’m not sure how to decode the hdf5 file. I keep encountering this message from pandas.read\_hdf:

“Support for generic buffers has not been implemented.”

Below is the relevant code:

```auto
@app.callback(Output('table', 'rows'),
              [Input('upload-data', 'contents'),
               Input('upload-data', 'filename')])
def store_user_data(contents, filename):
        content_type, content_string = contents.split(',')
        print("content_type = {}".format(content_type))
        decoded = base64.b64decode(content_string)
        print("decoded...")
        try:
                if 'hdf5' in filename or 'h5' in filename:
                        df = pd.read_hdf(io.BytesIO(decoded), key='rpkm')
                        print("df.shape = {}".format(df.shape))
        except Exception as e:
                print(e)
                return html.Div(['There was an error processing this file.'])
        
        return df.to_dict('records')

```

---

<div class="post-metadata">

**Author:** ![amiralavi](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/amiralavi/32/3484_2.png) [@amiralavi](https://community.plotly.com/u/amiralavi)\
**Post date:** [June 28, 2018, 5:39pm UTC](https://community.plotly.com/t/parse-user-uploaded-hdf5/11311/2 "2018-06-28T17:39:00Z")

</div>

In case anyone else has this issue, here is how to decoded an HDF5 file that you get from a dcc.Upload component:

> <https://github.com/pandas-dev/pandas/issues/9246#issuecomment-74041497>
