forked from lyy005/Intro_Biocom_ND_319_Tutorial5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEX_5_Script
More file actions
25 lines (22 loc) · 1.21 KB
/
Copy pathEX_5_Script
File metadata and controls
25 lines (22 loc) · 1.21 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
import numpy
import os
os.listdir('.')
os.chdir('/Users/sampathkumarbalaji/EX_5/Intro_Biocom_ND_319_Tutorial5')
import pandas
wages_csv=pandas.read_csv("wages.csv")
col_unq_sort_gen_yrs = (wages_csv.iloc[:,0:2]).drop_duplicates(keep='first').sort_values(by='gender', ascending=True).sort_values(by= 'yearsExperience', ascending=True)
col_unq_sort_gen_yrs.to_csv('ex5.csv', sep=' ', index=False)
print ('Highest earner:')
earner_H = wages_csv.sort_values(by='wage', ascending=False).iloc[0:1, [0,1,3]]
print (earner_H.to_string(index=False))
print ('Lowest earner:')
earner_L = wages_csv.sort_values(by='wage', ascending=True).iloc[0:1, [0,1,3]]
print (earner_L.to_string(index=False))
print ('Women in Top 10 Earners:')
earner_top10_w = wages_csv.sort_values(by='wage', ascending=False).iloc[0:11, [0,1,3]]
earner_number_of_women = (earner_top10_w[earner_top10_w.gender=="female"]).shape[0]
print (earner_number_of_women)
print('Effect - Graduating College on Minimum Wage:')
min_wages_12 = (wages_csv[wages_csv.yearsSchool==12]).sort_values(by='wage', ascending=True).iloc[0:1, 3]
min_wages_16 = (wages_csv[wages_csv.yearsSchool==16]).sort_values(by='wage', ascending=True).iloc[0:1, 3]
print (min_wages_16.values - min_wages_12.values)