Home Article Practice 代码

代码

2022-06-15 22:59  views:523  source:小键人1002729    

data = pro.query('stock_basic', exchange='', list_status='L', \
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))



Disclaimer: The above articles are added by users themselves and are only for typing and communication purposes. They do not represent the views of this website, and this website does not assume any legal responsibility. This statement is hereby made! If there is any infringement of your rights, please contact us promptly to delete it.

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)