-
Notifications
You must be signed in to change notification settings - Fork 0
/
join.py
62 lines (45 loc) · 1.02 KB
/
join.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
#coding=utf-8
import tushare as ts
import pandas as pd
import time
# 行业分类
inds = ts.get_industry_classified()
inds.columns = ('code', 'name', 'industry')
time.sleep(1)
# 概念分类
concepts = ts.get_concept_classified()
concepts.columns = ('code', 'name', 'concept')
time.sleep(1)
# 地域分类
areas = ts.get_area_classified()
areas.columns = ('code', 'name', 'area')
time.sleep(1)
# 中小板块
smalls = ts.get_sme_classified()
time.sleep(1)
# 创业版
news = ts.get_gem_classified()
time.sleep(1)
# st版块
sts = ts.get_st_classified()
time.sleep(1)
# 沪深300
hss = ts.get_hs300s()
time.sleep(1)
# 上证50
szs = ts.get_sz50s()
time.sleep(1)
# 中证500
zzs = ts.get_zz500s()
time.sleep(1)
# 终止上市
tss = ts.get_terminated()
time.sleep(1)
# 暂停上市
ss = ts.get_terminated()
time.sleep(1)
# 股本
stock_basic = ts.get_stock_basics()
time.sleep(1)
news_basic = news.merge(inds, on='code', how='left').merge(concepts, on='code', how='left').merge(areas, on='code', how='left')