Hello
Good day to you.
If I run this script, it can run success.
but if I debug it. it will fail in exception.
could you please help me locate where is the issue?
Thank you.
Best Regards.
Scott
import akshare as ak
import pandas as pd
import datetime as dt
import numpy as np
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
#pd.set_option('display.max_colwidth', 180)
pd.set_option('display.unicode.ambiguous_as_wide', True)
pd.set_option('display.unicode.east_asian_width', True)
pd.set_option('display.width', 800) # 设置打印宽度,根据需要调整
kf2=ak.fund_open_fund_rank_em(symbol="全部")
def basicinfo(symbol):
df = ak.fund_individual_basic_info_xq(symbol)
return df
#print(opendate('019569'))
#print(kf.iloc[0])
i=0
basic=pd.DataFrame()
sj=pd.DataFrame()
yl=pd.DataFrame()
yj=pd.DataFrame()
while(i<len(kf2)):
basic=pd.DataFrame()
sj=pd.DataFrame()
yl=pd.DataFrame()
yj=pd.DataFrame()
t=pd.DataFrame()
fund_ID=kf2.loc[i,'基金代码']
try:
basic=ak.fund_individual_basic_info_xq(fund_ID)
kf2.loc[i,'OpenDate']=basic.iat[3,1]
kf2.loc[i,'FullName']=basic.iat[2,1]
kf2.loc[i,'Size']=basic.iat[4,1]
kf2.loc[i,'FundCompany']=basic.iat[5,1]
kf2.loc[i,'FundType']=basic.iat[8,1]
kf2.loc[i,'GradeCompany']=basic.iat[10,1]
kf2.loc[i,'FundGrade']=basic.iat[10,1]
except Exception as e:
if basic.size!=0:
print('index of: ' + str(i) + " 基金基本信息 fail by error: "+ str(e))
i=i+1
if i%100==0: print(kf2.iloc[:i])
I get error as below
pydev debugger: starting (pid: 29256)
Traceback (most recent call last):
File "C:\Users\Scott\.p2\pool\plugins\org.python.pydev.core_12.0.0.202402010911\pysrc\pydevd.py", line 3616, in <module>
main()
File "C:\Users\Scott\.p2\pool\plugins\org.python.pydev.core_12.0.0.202402010911\pysrc\pydevd.py", line 3609, in main
globals = debugger.run(setup['file'], None, None, is_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Scott\.p2\pool\plugins\org.python.pydev.core_12.0.0.202402010911\pysrc\pydevd.py", line 2626, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Scott\.p2\pool\plugins\org.python.pydev.core_12.0.0.202402010911\pysrc\pydevd.py", line 2634, in _exec
globals = pydevd_runpy.run_path(file, globals, '__main__')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Scott\.p2\pool\plugins\org.python.pydev.core_12.0.0.202402010911\pysrc\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Scott\.p2\pool\plugins\org.python.pydev.core_12.0.0.202402010911\pysrc\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\Scott\.p2\pool\plugins\org.python.pydev.core_12.0.0.202402010911\pysrc\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "C:\Users\Scott\workspace\akshare1\2.py", line 57, in <module>
try:
File "<stringsource>", line 69, in cfunc.to_py.__Pyx_CFunc_object__lParenobject__comma_int__comma_int__rParen_to_py_4code_11from_offset_9to_offset.wrap
File "_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx", line 1236, in _pydevd_sys_monitoring_cython._jump_event
TypeError: an integer is required