import h5py
import numpy as np
import pandas as pd
filename = 'D:\data.h5'
f = h5py.File(filename, 'r')
# List all groups
print("Keys: %s" % f.keys())
a_group_key = list(f.keys())[0]
# Get the data
data = list(f[a_group_key])
pd.DataFrame(data).to_csv("hi.csv")
< /code>
Код: Выделить всё
Keys:
< /code>
When I print data I see following results:
print(data)
< /code>
['axis0',
'axis1',
'block0_items',
'block0_values',
'block1_items',
'block1_values']
< /code>
I would appreciate the if someone [b]explain[/b] me what are they and how I can extract [b]data completely[/b] and save it in .csv file. It seems there hasn't been a routine way to do that and it's kind of challenging yet! Until now I just could see part of data via:
import numpy as np
dfm = np.fromfile('D:\data.h5', dtype=float)
print (dfm.shape)
print(dfm[5:])
dfm=pd.to_csv('train.csv')
#dfm.to_csv('hi.csv', sep=',', header=None, index=None)
< /code>
My expectation is to extract [b]time_stamps[/b] and [b]measurements[/b] in .h5
Подробнее здесь: https://stackoverflow.com/questions/562 ... v-properly