code = str(stock_pool['代码'].values[0])
def gp_type_szsh(gp):
if gp.find('60',0,3)==0:
gp_type='SH'+gp
elif gp.find('688',0,4)==0:
gp_type='SH'+gp
elif gp.find('900',0,4)==0:
gp_type='SH'+gp
elif gp.find('00',0,3)==0:
gp_type='SZ'+gp
elif gp.find('300',0,4)==0:
gp_type='SZ'+gp
elif gp.find('200',0,4)==0:
gp_type='SZ'+gp
return gp_type
code = gp_type_szsh(code)
获取指数成分股,并区别‘sz’,‘sh’
于 2022-02-19 21:19:31 首次发布