使用 h5py 匯入 HDF5 檔案
本練習屬於課程
Python 資料匯入入門
練習說明
- 匯入套件
h5py。 - 將檔案名稱指定給變數
file。 - 以唯讀模式載入檔案到變數
data。 - 印出
data的資料型別。 - 列印 HDF5 檔案
'LIGO_data.hdf5'中所有群組的名稱。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import packages
import numpy as np
import ____
# Assign filename: file
# Load file: data
data = h5py.File(____, ____)
# Print the datatype of the loaded file
# Print the keys of the file
for key in ____:
print(____)