-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathextract_province.py
238 lines (159 loc) · 6 KB
/
extract_province.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
import pandas as pd
from tqdm import tqdm
df = pd.read_csv('thaisum.csv', encoding='utf-8')
acr = atg = aya = bkk = bkn = brm = cbi = cco = cmi = cnt = cpm = cpn = cri = cti = kbi = kkn = kpt = kri = ksn = lei = lpg = lpn = lri = mdh = mkm = msn = nan = nbi = nbp = nki = nma = npm = npt = nrt = nsn = nwt = nyk = pbi = pct = pkn = pkt = plg = plk = pna = pnb = pre = pri = pte = ptn = pyo = rbr = ret = rng = ryg = sbr = ska = skm = skn = skw = sni = snk = spb = spk = sri = srn = ssk = sti = stn = tak = trg = trt = ubn = udn = utd = uti = yla = yst = 0
for index, row in tqdm(df.iterrows(), total=df.shape[0]):
if "กระบี่" in row["body"]:
kbi = kbi + 1
if "กรุงเทพมหานคร" in row["body"]:
bkk = bkk + 1
if "กาญจนบุรี" in row["body"]:
kri = kri + 1
if "กาฬสินธุ์" in row["body"]:
ksn = ksn + 1
if "กำแพงเพชร" in row["body"]:
kpt = kpt + 1
if "ขอนแก่น" in row["body"]:
kkn = kkn + 1
if "จันทบุรี" in row["body"]:
cti = cti + 1
if "ฉะเชิงเทรา" in row["body"]:
cco = cco + 1
if "ชลบุรี" in row["body"]:
cbi = cbi + 1
if "ชัยนาท" in row["body"]:
cnt = cnt + 1
if "ชัยภูมิ" in row["body"]:
cpm = cpm + 1
if "ชุมพร" in row["body"]:
cpn = cpn + 1
if "เชียงราย" in row["body"]:
cri = cri + 1
if "เชียงใหม่" in row["body"]:
cmi = cmi + 1
if "ตรัง" in row["body"]:
trg = trg + 1
if "ตราด" in row["body"]:
trt = trt + 1
if "ตาก" in row["body"]:
tak = tak + 1
if "นครนายก" in row["body"]:
nyk = nyk + 1
if "นครปฐม" in row["body"]:
npt = npt + 1
if "นครพนม" in row["body"]:
npm = npm + 1
if "นครราชสีมา" in row["body"]:
nma = nma + 1
if "นครศรีธรรมราช" in row["body"]:
nrt = nrt + 1
if "นครสวรรค์" in row["body"]:
nsn = nsn + 1
if "นนทบุรี" in row["body"]:
nbi = nbi + 1
if "นราธิวาส" in row["body"]:
nwt = nwt + 1
if "น่าน" in row["body"]:
nan = nan + 1
if "บึงกาฬ" in row["body"]:
bkn = bkn + 1
if "บุรีรัมย์" in row["body"]:
brm = brm + 1
if "ปทุมธานี" in row["body"]:
pte = pte + 1
if "ประจวบคีรีขันธ์" in row["body"]:
pkn = pkn + 1
if "ปราจีนบุรี" in row["body"]:
pri = pri + 1
if "ปัตตานี" in row["body"]:
ptn = ptn + 1
if "พะเยา" in row["body"]:
pyo = pyo + 1
if "พระนครศรีอยุธยา" in row["body"]:
aya = aya + 1
if "พังงา" in row["body"]:
pna = pna + 1
if "พัทลุง" in row["body"]:
plg = plg + 1
if "พิจิตร" in row["body"]:
pct = pct + 1
if "พิษณุโลก" in row["body"]:
plk = plk + 1
if "เพชรบุรี" in row["body"]:
pbi = pbi + 1
if "เพชรบูรณ์" in row["body"]:
pnb = pnb + 1
if "แพร่" in row["body"]:
pre = pre + 1
if "ภูเก็ต" in row["body"]:
pkt = pkt + 1
if "มหาสารคาม" in row["body"]:
mkm = mkm + 1
if "มุกดาหาร" in row["body"]:
mdh = mdh + 1
if "แม่ฮ่องสอน" in row["body"]:
msn = msn + 1
if "ยโสธร" in row["body"]:
yst = yst + 1
if "ยะลา" in row["body"]:
yla = yla + 1
if "ร้อยเอ็ด" in row["body"]:
ret = ret + 1
if "ระนอง" in row["body"]:
rng = rng + 1
if "ระยอง" in row["body"]:
ryg = ryg + 1
if "ราชบุรี" in row["body"]:
rbr = rbr + 1
if "ลพบุรี" in row["body"]:
lri = lri + 1
if "ลำปาง" in row["body"]:
lpg = lpg + 1
if "ลำพูน" in row["body"]:
lpn = lpn + 1
if "เลย" in row["body"]:
lei = lei + 1
if "ศรีสะเกษ" in row["body"]:
ssk = ssk + 1
if "สกลนคร" in row["body"]:
snk = snk + 1
if "สงขลา" in row["body"]:
ska = ska + 1
if "สตูล" in row["body"]:
stn = stn + 1
if "สมุทรสงคราม" in row["body"]:
skm = skm + 1
if "สมุทรปราการ" in row["body"]:
spk = spk + 1
if "สมุทรสาคร" in row["body"]:
skn = skn + 1
if "สระแก้ว" in row["body"]:
skw = skw + 1
if "สระบุรี" in row["body"]:
sri = sri + 1
if "สิงห์บุรี" in row["body"]:
sbr = sbr + 1
if "สุโขทัย" in row["body"]:
sti = sti + 1
if "สุพรรณบุรี" in row["body"]:
spb = spb + 1
if "สุราษฎร์ธานี" in row["body"]:
sni = sni + 1
if "สุรินทร์" in row["body"]:
srn = srn + 1
if "หนองคาย" in row["body"]:
nki = nki + 1
if "หนองบัวลำภู" in row["body"]:
nbp = nbp + 1
if "อ่างทอง" in row["body"]:
atg = atg + 1
if "อำนาจเจริญ" in row["body"]:
acr = acr + 1
if "อุดรธานี" in row["body"]:
udn = udn + 1
if "อุตรดิตถ์" in row["body"]:
utd = utd + 1
if "อุทัยธานี" in row["body"]:
uti = uti + 1
if "อุบลราชธานี" in row["body"]:
ubn = ubn + 1