QA高级财务执行示例提示:KeyError: '317'
发布于 2 个月前 作者 lovingfantasy 105 次浏览 来自 报bug
  • 执行示例代码如下:
	import QUANTAXIS as QA
	import pandas as pd
	res=QA.QA_fetch_financial_report(['000001','600100'],['2017-03-31','2017-06-30','2017-09-31','2017-12-31','2018-03-31']
	res
  • QA环境
	pytdx                       1.72 
	quantaxis                   1.9.11    
	quantaxis-otgbroker         1.9.2     
	quantaxis-pubsub            1.9       
	quantaxis-randomprice       1.1       
	quantaxis-run               1.9       
	quantaxis-servicedetect     0.0.3     
	quantaxis-webserver         1.8.0   
  • 报错信息
	---------------------------------------------------------------------------
	KeyError                                  Traceback (most recent call last)
	<ipython-input-1-1e8da0e4c8ea> in <module>
		  1 import QUANTAXIS as QA
		  2 import pandas as pd
	----> 3 res=QA.QA_fetch_financial_report(['000001','600100'],['2017-03-31','2017-06-30','2017-09-31','2017-12-31','2018-03-31'])
		  4 res
	
	/usr/local/lib/python3.6/site-packages/QUANTAXIS/QAFetch/QAQuery.py in QA_fetch_financial_report(code, report_date, ltype, db)
	   1398             return None
	   1399     except Exception as e:
	-> 1400         raise e
	   1401 
	   1402 
	
	/usr/local/lib/python3.6/site-packages/QUANTAXIS/QAFetch/QAQuery.py in QA_fetch_financial_report(code, report_date, ltype, db)
	   1380                 endict['code'] = 'code'
	   1381                 endict['report_date'] = 'report_date'
	-> 1382                 res_pd.columns = res_pd.columns.map(lambda x: endict[x])
	   1383 
	   1384             if res_pd.report_date.dtype == numpy.int64:
	
	/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py in map(self, mapper, na_action)
	   4516         from .multi import MultiIndex
	   4517         new_values = super(Index, self)._map_values(
	-> 4518             mapper, na_action=na_action)
	   4519 
	   4520         attributes = self._get_attributes_dict()
	
	/usr/local/lib/python3.6/site-packages/pandas/core/base.py in _map_values(self, mapper, na_action)
	   1216 
	   1217         # mapper is a function
	-> 1218         new_values = map_f(values, mapper)
	   1219 
	   1220         return new_values
	
	pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()
	
	/usr/local/lib/python3.6/site-packages/QUANTAXIS/QAFetch/QAQuery.py in <lambda>(x)
	   1380                 endict['code'] = 'code'
	   1381                 endict['report_date'] = 'report_date'
	-> 1382                 res_pd.columns = res_pd.columns.map(lambda x: endict[x])
	   1383 
	   1384             if res_pd.report_date.dtype == numpy.int64:

KeyError: '317' 
  • 请问该如何解决?
2 回复

感谢天神!升级后解决!

	pip install --upgrade quantaxis==1.9.16
回到顶部