使用 python 创建 hdf5 文件后,我 运行 陷入 ValueError

I'm running into a ValueError after creating an hdf5 file with python

我正在尝试为我的算法创建一个 h5 文件,但我继续收到以下 ValueError:

我通过在使用模式“w”创建文件后删除第 11 行来回答我的问题。这允许在不调用 'f.create_dataset' 的情况下以模式“r+”读取文件。

  9 #Import Data
  10 f = h5py.File("orderbook.hdf5", "r+")
 ---> 11 dset = f.create_dataset("orderbook_dataset", (100,), dtype='i')