Registry Mirror
搜索
Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Files
Expand file tree
master
Breadcrumbs
python
/
printjson.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
30 lines (26 loc) · 1 KB
master
Breadcrumbs
python
/
printjson.py
Copy path
Top
File metadata and controls
Code
Blame
30 lines (26 loc) · 1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import glob
import json
from typing import Any
def print_scores():
scores = {}
for filename in glob.glob('*.json'):
scores[filename] = {}
with open(filename) as infile:
for result in json.load(infile):
for subject, score in result.items():
scores[filename].setdefault(subject, [])
scores[filename][subject].append(score)
for one_class, class_scores in scores.items():
print(one_class)
for subject, subject_scores in class_scores.items():
min_score = min(subject_scores)
max_score = max(subject_scores)
average_score = (sum(subject_scores) / len(subject_scores))
print(f'{subject}')
print(f'\tmin {min_score}')
print(f'\tmax {max_score}')
print(f'\taverage {average_score}')
def print_json(data: Any) -> None:
"""Print the given data as formatted JSON."""
print(json.dumps(data, indent=4, sort_keys=True))
print_scores()
You can’t perform that action at this time.