问题记录——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

问题解决。

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