# HDF5

HDF5 files have no fixed layout, so you read the arrays you need with [h5py](https://docs.h5py.org/) and upload them as a table. Each array other than the timestamps becomes a channel.

## Before you start

Install h5py:

```bash
pip install h5py
```

## Upload a file

From Python, read the arrays into a pandas DataFrame and upload it:

```python
from datetime import datetime, timezone

import h5py
import pandas as pd

from nominal import ts
from nominal.core import NominalClient
from nominal.thirdparty.pandas import upload_dataframe_to_dataset

client = NominalClient.from_profile("default")
dataset = client.create_dataset("IMU from HDF5")
started = datetime(2026, 1, 1, 12, 0, tzinfo=timezone.utc)

with h5py.File("imu.h5") as f:
    imu = f["sensors/imu"]
    names = ["time_s", "accel_x", "accel_y"]
    df = pd.DataFrame({name: imu[name][:] for name in names})

upload_dataframe_to_dataset(
    dataset,
    df,
    timestamp_column="time_s",
    timestamp_type=ts.Relative("seconds", start=started),
)
```

For a file larger than memory, read and upload it in slices, as in [Upload in batches](https://dev.nominal.io/python/guides/datasets/hdf-5.md#upload-in-batches). To find the arrays in a file, see [Inspect the file](https://dev.nominal.io/python/guides/datasets/hdf-5.md#inspect-the-file).
