問題記錄——pd.read_hdf throws 'cannot set WRITABLE flag to True of this array'

問題記錄——pd.read_hdf throws 'cannot set WRITABLE flag to True of this array'

可以使用如下寫入h5文件

df.to_hdf('../testA.h5', 'df')

但是無法讀取h5文件

a = pd.read_hdf("../testA.h5","df")
a

報錯:

~/.local/lib/python3.6/site-packages/pandas/io/pytables.py in read_array(self, key, start, stop) 2487 2488 if isinstance(node, tables.VLArray): -> 2489 ret = node[0][start:stop] 2490 else: 2491 dtype = getattr(attrs, 'value_type', None)

~/.local/lib/python3.6/site-packages/tables/vlarray.py in getitem(self, key)

~/.local/lib/python3.6/site-packages/tables/vlarray.py in read(self, start, stop, step)

tables/hdf5extension.pyx in tables.hdf5extension.VLArray._read_array()

ValueError: cannot set WRITEABLE flag to True of this array

解決辦法:降級numpy

降級前numpy.version 1.18.0

pip install numpy==1.15

問題解決。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章