Update fb percent dataset
This commit is contained in:
parent
2839aa9237
commit
aeeac49182
2 changed files with 23 additions and 23 deletions
|
@ -19,14 +19,14 @@ data = []
|
|||
def population(country):
|
||||
countryCode = pycountry.countries.search_fuzzy(country)[0].alpha_3
|
||||
res = requests.get('https://restcountries.eu/rest/v2/alpha/' + countryCode)
|
||||
return json.loads(res.content)['population']
|
||||
return int(json.loads(res.content)['population'])
|
||||
|
||||
for td1, td2 in zip(tds[::2], tds[1::2]):
|
||||
frame = {}
|
||||
frame['country'] = td1.text.strip()
|
||||
frame['active'] = td2.text.strip()
|
||||
frame['active'] = int(td2.text.strip()) * 1000000
|
||||
frame['population'] = population(frame['country'])
|
||||
frame['percentActive'] = (int(frame['active']) * 1000000 / int(frame['population'])) * 100
|
||||
frame['percentActive'] = (frame['active'] / frame['population']) * 100
|
||||
data.append(frame)
|
||||
|
||||
# Save the data
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
,country,active,population,percentActive
|
||||
0,India,340,1295210000,26.250569405733433
|
||||
1,United States,200,323947000,61.738494259863494
|
||||
2,Indonesia,140,258705000,54.11569161786591
|
||||
3,Brazil,130,206135893,63.065193600223715
|
||||
4,Mexico,98,122273473,80.14821007006155
|
||||
5,Philippines,88,103279800,85.20543223360231
|
||||
6,Vietnam,71,92700000,76.59115426105717
|
||||
7,Thailand,54,65327652,82.6602492922905
|
||||
8,Egypt,47,91290000,51.484280863183265
|
||||
9,Bangladesh,46,161006790,28.570223653300587
|
||||
10,Pakistan,45,194125062,23.18093271233572
|
||||
11,Colombia,38,48759958,77.93279887566761
|
||||
12,United Kingdom,38,65110000,58.36277069574566
|
||||
13,Turkey,37,78741053,46.98946558410896
|
||||
14,France,33,66710000,49.46784590016489
|
||||
15,Argentina,31,43590400,71.11657612685362
|
||||
16,Italy,31,60665551,51.099840830589336
|
||||
17,Nigeria,31,186988000,16.578603974586603
|
||||
18,Germany,28,81770900,34.24201029950753
|
||||
19,Peru,27,31488700,85.74504504790607
|
||||
0,India,340000000,1295210000,26.250569405733433
|
||||
1,United States,200000000,323947000,61.738494259863494
|
||||
2,Indonesia,140000000,258705000,54.11569161786591
|
||||
3,Brazil,130000000,206135893,63.065193600223715
|
||||
4,Mexico,98000000,122273473,80.14821007006155
|
||||
5,Philippines,88000000,103279800,85.20543223360231
|
||||
6,Vietnam,71000000,92700000,76.59115426105717
|
||||
7,Thailand,54000000,65327652,82.6602492922905
|
||||
8,Egypt,47000000,91290000,51.484280863183265
|
||||
9,Bangladesh,46000000,161006790,28.570223653300587
|
||||
10,Pakistan,45000000,194125062,23.18093271233572
|
||||
11,Colombia,38000000,48759958,77.93279887566761
|
||||
12,United Kingdom,38000000,65110000,58.36277069574566
|
||||
13,Turkey,37000000,78741053,46.98946558410896
|
||||
14,France,33000000,66710000,49.46784590016489
|
||||
15,Argentina,31000000,43590400,71.11657612685362
|
||||
16,Italy,31000000,60665551,51.099840830589336
|
||||
17,Nigeria,31000000,186988000,16.578603974586603
|
||||
18,Germany,28000000,81770900,34.24201029950753
|
||||
19,Peru,27000000,31488700,85.74504504790607
|
||||
|
|
|
Loading…
Reference in a new issue