QA.QA_fetch_index_list_adv() 报错,QA.QAFetch.QATdx.QA_fetch_get_index_list()却不会
发布于 2 个月前 作者 nuswgg 97 次浏览 来自 问答

报错如下,不晓得为什么pandas会报错,望天总指导,谢谢


KeyError Traceback (most recent call last) <ipython-input-2-48103cca9326> in <module>() ----> 1 QA.QA_fetch_index_list_adv()

f:\ProgramData\Anaconda3\lib\site-packages\QUANTAXIS\QAFetch\QAQuery_Advance.py in QA_fetch_index_list_adv(collections) 336 :return: DataFrame 337 ‘’’ –> 338 index_list_items = QA_fetch_index_list(collections) 339 if len(index_list_items) == 0: 340 print(“QA Error QA_fetch_index_list_adv call item for item in collections.find() return 0 item, maybe the DATABASE.index_list is empty!”)

f:\ProgramData\Anaconda3\lib\site-packages\QUANTAXIS\QAFetch\QAQuery.py in QA_fetch_index_list(collections) 163 def QA_fetch_index_list(collections=DATABASE.index_list): 164 ‘获取指数列表’ –> 165 return pd.DataFrame([item for item in collections.find()]).drop(’_id’, axis=1, inplace=False).set_index(‘code’, drop=False) 166 167

f:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in drop(self, labels, axis, index, columns, level, inplace, errors) 3938 index=index, columns=columns, 3939 level=level, inplace=inplace, -> 3940 errors=errors) 3941 3942 @rewrite_axis_style_signature(‘mapper’, [(‘copy’, True),

f:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in drop(self, labels, axis, index, columns, level, inplace, errors) 3778 for axis, labels in axes.items(): 3779 if labels is not None: -> 3780 obj = obj._drop_axis(labels, axis, level=level, errors=errors) 3781 3782 if inplace:

f:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in _drop_axis(self, labels, axis, level, errors) 3810 new_axis = axis.drop(labels, level=level, errors=errors) 3811 else: -> 3812 new_axis = axis.drop(labels, errors=errors) 3813 result = self.reindex(**{axis_name: new_axis}) 3814

f:\ProgramData\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in drop(self, labels, errors) 4963 if errors != ‘ignore’: 4964 raise KeyError( -> 4965 ‘{} not found in axis’.format(labels[mask])) 4966 indexer = indexer[~mask] 4967 return self.delete(indexer)

KeyError: “[’_id’] not found in axis”

5 回复

可能是数据库没有数据,准备下载,发现QA 居然莫名其妙没有了

?? 没存数据而已

天总,怎么查tushare的pytdx ver, 显示错误

重新安装了2次后,问题解决了

回到顶部