2020-12-26
作者:互联网
获取行业哑变量
from jqdatasdk import *
import pandas as pd
#以上证50为例
stocks = get_index_stocks('000016.XSHG')
df2 = pd.DataFrame(list(map(lambda x:get_industry(x,strfdatenow)[x]['sw_l1']['industry_code'],stocks)),
index=stocks,columns=['ind'])
df2 = pd.get_dummies(df2)
print(df2)
标签:index,26,12,get,df2,2020,pd,import,stocks 来源: https://blog.csdn.net/m0_46321344/article/details/111771302