-
Notifications
You must be signed in to change notification settings - Fork 1
/
Titration.py
59 lines (29 loc) · 1.05 KB
/
Titration.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
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import Constants
# In[2]:
# Constants
INPUT_FILE_PATH = '.\\data\\sample\\sample_1.xlsx'
# In[5]:
# Import data file
df = pd.read_excel(INPUT_FILE_PATH)
df.head()
# In[10]:
result_df = pd.DataFrame()
for dept in Constants.DEPTS:
single_dept = df[df['Dept'] == dept]
filtered = pd.DataFrame()
for major in Constants.DEPTS_MAJORS[dept]:
single_major = df[df['Major Code'] == major]
filtered = filtered.append(single_major, ignore_index=True)
for standing in Constants.CLASS_STANDINGS:
single_standing = filtered[filtered['Class Standing'] == standing]
top_n = single_standing.quantile(Constants.CLASS_QUANTILE[standing])[0]
top_n = single_standing[single_standing['Cum GPA'] >= top_n]
result_df = result_df.append(top_n, ignore_index=True)
result_df = result_df[['First Name', 'Last Name', 'Major Code', 'Dept', 'Email']]
# In[11]:
result_df.to_excel('results.xlsx', index=False)
# In[ ]: