-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
48 lines (35 loc) · 1.32 KB
/
main.py
File metadata and controls
48 lines (35 loc) · 1.32 KB
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
#import dash
import pandas as pd
from typing import Optional
import sys
import os
def read_test_files(prefix: str, school: Optional[str] = "Great Neck") -> pd.DataFrame:
rolls = [
"Achievement Roll",
"Honor Roll",
"Dist Honor Roll"
]
dfs = []
for roll in rolls:
fn = os.path.dirname(__file__) + "/data/" + f"{prefix}_{roll}.csv"
df = pd.read_csv(fn, skiprows=[0, 1, 2])
df["Type"] = roll
dfs.append(df)
df = pd.concat(dfs)
if school is not None:
df = df[df["SchoolName"].str.contains(school)]
df = df.drop_duplicates(subset=["score", "First_initial", "lastname", "grade"], keep="last")\
.sort_values(by=["score", "grade"], ascending=[False, True])
return df
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
pd.set_option("display.max_rows", 20)
pd.set_option("display.max_columns", 100)
pd.set_option("display.width", 1000)
df_2021f_10a = read_test_files("2021Fall_AMC10A", "Great Neck")
df_2021f_10b = read_test_files("2021Fall_AMC10B", "Great Neck")
df_2021_10a = read_test_files("2021_AMC10A", "Great Neck")
df_2021_10b = read_test_files("2021_AMC10B", "Great Neck")
df_2022_8 = read_test_files("2022_AMC8", "Great Neck")
print(df_2022_8)
print("done")