本文整理汇总了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)