Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: UTF-8 -*-
- import urllib, json
- url = "https://w3qa5ydb4l.execute-api.eu-west-1.amazonaws.com/prod/finnishCoronaData"
- caseData = json.load(urllib.urlopen(url))
- confirmed = caseData['confirmed']
- print("Total: " + str(len(confirmed)))
- def count_em(lst, key):
- labels = {}
- unk = 0
- for case in lst:
- la = case.get(key)
- if la:
- labels[la] = 1 + labels.get(la,0)
- else:
- unk += 1
- for k, v in sorted(labels.items(), key=lambda t: t[0]):
- print(" " + k + ": " + str(v))
- if unk:
- print(" UNKNOWN: " + str(unk))
- print("Area:")
- count_em(confirmed, 'healthCareDistrict')
- print("Source country:")
- count_em(confirmed, 'infectionSourceCountry')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement