diff --git a/Exercise5b.py b/Exercise5b.py new file mode 100755 index 0000000..143228c --- /dev/null +++ b/Exercise5b.py @@ -0,0 +1,11 @@ +import pandas +wages=pandas.read_csv("wages.csv") +wages.drop([col for col in wages.columns if 'yearsSchool' in col],axis=1,inplace=True) +cc=(wages.sort_values(by='wage')) +print ("Lowest Earner") +print (cc.head(n=1)) +print ("Highest Earner") +print (cc.tail(n=1)) +print ("Top 10 Female Earners") +numoffemales=wages[wages['wage']>=wages['wage'].nlargest(10).iloc[-1]]['gender'].eq('female').sum() +print (numoffemales) diff --git a/Exercise5c.py b/Exercise5c.py new file mode 100755 index 0000000..8a8a1f6 --- /dev/null +++ b/Exercise5c.py @@ -0,0 +1,8 @@ +import pandas +wages=pandas.read_csv("wages.csv") +ed12=wages[wages.yearsSchool==12] #12 years of education +minimum12=min(ed12.wage) #minimum wage of 12 +ed16=wages[wages.yearsSchool==16] #16 years of education +minimum16=min(ed16.wage) #minimum wage of 16 +print (minimum16-minimum12) + diff --git a/part1.py b/part1.py new file mode 100644 index 0000000..91ab6f4 --- /dev/null +++ b/part1.py @@ -0,0 +1,16 @@ +import os + +with open('wages.csv','r') as f: + file = f.readlines() + + + + +for line in file: + line = line.split(',') + gender = line[0] + exp = line[1] + str = gender + ' ' + exp + '\n' + with open('new.txt', 'a') as n: + n.write(str) +