代码
fields='ts_code,symbol,name,area,industry,list_date')
# 剔除出包含ST的股票
st_data = data[data.name.str.contains('ST')]
sts = st_data['name'].values.tolist()
for st in sts:
data = data.drop(index=(data.loc[(data['name'] == st)].index))
#剔除出创业板的股票
cy_data = data[data.ts_code.str.contains('^30')]
cys = cy_data['ts_code'].values.tolist()
for cy in cys:
data = data.drop(index=(data.loc[(data['ts_code'] == cy)].index))
# 剔除出科创板的股票
kc_data = data[data.ts_code.str.contains('^68')]
kcs = kc_data['ts_code'].values.tolist()
for kc in kcs:
data = data.drop(index=(data.loc[(data['ts_code'] == kc)].index))