本文整理匯總了Python中tushare.get_industry_classified方法的典型用法代碼示例。如果您正苦於以下問題:Python tushare.get_industry_classified方法的具體用法?Python tushare.get_industry_classified怎麽用?Python tushare.get_industry_classified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tushare
的用法示例。
在下文中一共展示了tushare.get_industry_classified方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_industry_classified
# 需要導入模塊: import tushare [as 別名]
# 或者: from tushare import get_industry_classified [as 別名]
def get_industry_classified(self):
"""
行業分類
code name c_name
"""
industry = ts.get_industry_classified()
industry = industry[['code','name','c_name']]
industry.columns = ['code','name','industryName']
##合並多個行業分類
industryDict = {}
for line in industry.to_dict('record'):
if industryDict.get(line['code']) is None:
industryDict[line['code']] = []
industryDict[line['code']].append(line['industryName'])
industry = pd.DataFrame(industryDict.items(),columns=['code','industryName'])
if self.data is None:
self.data = industry
示例2: __init__
# 需要導入模塊: import tushare [as 別名]
# 或者: from tushare import get_industry_classified [as 別名]
def __init__(self,save=True):
"""
"""
self.columns = ['code',
'name',
'industryName',##行業名稱
'conceptName',##概念分類
'areaName',##地域分類
'smeName',##是否屬於中小板分類
'gemName',##是否屬於創業板分類
'stName',##是否屬於警示板分類
'hs300s',##是否是滬深300當前成份股及所占權重
'sz50s',##獲取上證50成份股
'zz500s',##中證500成份股
'terminated',##終止上市股票列表
'suspended',##暫停上市股票列表
]
self.data = None
self.get_industry_classified()
self.get_concept_classified()
self.get_area_classified()
self.get_sme_classified()
self.get_gem_classified()
self.get_st_classified()
self.get_hs300s_classified()
self.get_sz50s_classified()
self.get_zz500s_classified()
self.get_terminated_classified()
self.get_suspended_classified()
now = dt.datetime.now()
self.data['datatime'] = now.strftime('%Y-%m-%d')
self.data['datatimestramp'] = now.strftime('%H:%M:%S')
indexlist = ['code','datatime']##數據庫索引
tableName = 'symbClassified'
database(self.data,indexlist,tableName,save)
示例3: classify_info_to_sql
# 需要導入模塊: import tushare [as 別名]
# 或者: from tushare import get_industry_classified [as 別名]
def classify_info_to_sql():
create_classify_table()
a = ts.get_industry_classified()
a.columns = ['code', 'name', 'industry']
b = ts.get_area_classified()
c = ts.get_sz50s()
c = c.iloc[:,1::]
c['sz50'] = '1'
d = ts.get_hs300s()
d = d.iloc[:,1::]
d.columns = ['code','name','hs300_weight']
e = ts.get_zz500s()
e = e.iloc[:,1::]
e.columns = ['code','name','zz500_weight']
result = pd.merge(a, b, how='left', on=None, left_on=None, right_on=None,
left_index=False, right_index=False, sort=True,
suffixes=('_x', '_y'), copy=True, indicator=False)
result = pd.merge(result, c, how='left', on=None, left_on=None, right_on=None,
left_index=False, right_index=False, sort=True,
suffixes=('_x', '_y'), copy=True, indicator=False)
result = pd.merge(result, d, how='left', on=None, left_on=None, right_on=None,
left_index=False, right_index=False, sort=True,
suffixes=('_x', '_y'), copy=True, indicator=False)
result = pd.merge(result, e, how='left', on=None, left_on=None, right_on=None,
left_index=False, right_index=False, sort=True,
suffixes=('_x', '_y'), copy=True, indicator=False)
df_to_mysql('anack_classify',result)
# -------------------------------------------------------------
示例4: industry
# 需要導入模塊: import tushare [as 別名]
# 或者: from tushare import get_industry_classified [as 別名]
def industry():
return ts.get_industry_classified()
示例5: plot_days
# 需要導入模塊: import tushare [as 別名]
# 或者: from tushare import get_industry_classified [as 別名]
def plot_days():
if request.method == 'GET' :
today = ts.get_today_all()
code_info = ts.get_industry_classified()
today['code'] = today['code'].astype(unicode)
one_day = gd.get_data_real_time(code_info, today)
body = heatmap.get_heatmap('Today', one_day)
return render_template('heatmap.html', body=body)