在anaconda有的环境报错(structures must have the same size)
Closed this issue · 3 comments
根据下面的错误信息,我修改了dzh.py的dividend_to_h5()函数与h5.py的write_dataframe_set_struct_keep_head()函数,就可以了。
请确认一下。
====dzh.py=============
def dividend_to_h5(input_path, data):
del data['index_datetime'] #增加了这一行
write_dataframe_set_struct_keep_head(input_path, data, dzh_h5_type, 'Dividend')
return
====h5.py===============
def write_dataframe_set_struct_keep_head(path, data, dtype, dateset_name):
"""
保存DataFrame数据
保留表头
可以用来存K线,除权除息等信息
:param path:
:param data:
:param dtype:
:param dateset_name:
:return:
"""
f = h5py.File(path, 'w')
r = data.to_records(index=False) #增加了index=False
d = np.array(r, dtype=dtype)
f.create_dataset(dateset_name, data=d, compression="gzip", compression_opts=6)
f.close()
return
===============下面是错误信息==============
b'SZ300520'
structures must have the same size
b'SH600616'
structures must have the same size
b'SZ002695'
structures must have the same size
structures must have the same size
奇怪了,这些代码我每周都在用,并没有问题。
你的python 版本号,多少位的能说说吗?
是64位环境
conda --version
conda 4.4.10
python --version
Python 3.6.4 :: Anaconda, Inc.
您好,我再现了你的问题,的确存在,同时也按你的提示进行了修改,感谢!