matchifang
matchifang

Reputation: 5450

How to access the root group object of h5 file

I want to get the root group object of the h5 file and add attributes to it, instead of creating a new subgroup like what I have now:

f = h5py.File("test.h5", "w")
grp = f.create_group("group1")
grp.attrs['att'] = 0

Upvotes: 0

Views: 1133

Answers (1)

John Zwinck
John Zwinck

Reputation: 249434

A h5py.File is its own root group, so:

f.attrs['att'] = 0

Upvotes: 2

Related Questions