-
Notifications
You must be signed in to change notification settings - Fork 11
holm-loh submission #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
fda367e
9cbaddf
00b2009
74fbe74
0437eae
4f9087d
505343f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import pandas | ||
|
|
||
| wages = pandas.read_csv("wages.csv") | ||
|
|
||
| genderYears = pandas.DataFrame(wages,columns=['gender','yearsExperience']) | ||
| genderYears.drop_duplicates(['gender','yearsExperience'], keep='first', inplace=True) | ||
| genderYears.sort_values(['gender','yearsExperience'], ascending=[True, True], inplace=True) | ||
| genderYears.to_csv('uniqueGenderYears.txt', sep=' ') | ||
|
|
||
| print("Highest earner:") | ||
| print(wages.loc[wages['wage'].argmax(), ['gender', 'yearsExperience', 'wage']]) | ||
|
|
||
| print("Lowest earner:") | ||
| print(wages.loc[wages['wage'].argmin(), ['gender', 'yearsExperience', 'wage']]) | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't find the answer to the number of females in the top ten earners -0.25 |
||
| collegeSalery = 0; | ||
| highSchoolSalery = 0; | ||
| collegeCount = 0; | ||
| highSchoolCount = 0; | ||
|
|
||
| for index in range(0, 3294 ,1): | ||
| if wages.loc[index, 'yearsSchool'] >= 16: | ||
| collegeCount += 1 | ||
| collegeSalery += wages.loc[index, 'wage'] | ||
| if wages.loc[index, 'yearsSchool'] <= 12: | ||
| highSchoolCount += 1 | ||
| highSchoolSalery += wages.loc[index, 'wage'] | ||
|
|
||
| collegeSalery = collegeSalery / collegeCount | ||
| highSchoolSalery = highSchoolSalery / highSchoolCount | ||
| print("Average salery for college graduates:") | ||
| print(collegeSalery) | ||
| print("Average salery for high school graduates:") | ||
| print(highSchoolSalery) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code looks good. But the question was asking the difference of the minimum wage (not average) between the two groups. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import numpy | ||
| import os | ||
| os.listdir(".") | ||
| os.chdir('/Users/zoeloh/Desktop/Intro_Biocom_ND_319_Tutorial5') | ||
| data = numpy.loadtxt(fname="test.dat",delimiter=" ") | ||
| data | ||
|
|
||
| data[:,0]==0 | ||
|
|
||
| data[;,0]>2 | ||
|
|
||
| data[data[:,0]>2,:] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| gender yearsExperience | ||
| 168 female 1 | ||
| 215 female 2 | ||
| 15 female 3 | ||
| 37 female 4 | ||
| 23 female 5 | ||
| 27 female 6 | ||
| 9 female 7 | ||
| 4 female 8 | ||
| 0 female 9 | ||
| 7 female 10 | ||
| 2 female 11 | ||
| 1 female 12 | ||
| 17 female 13 | ||
| 350 female 14 | ||
| 46 female 15 | ||
| 623 female 16 | ||
| 1784 male 2 | ||
| 1658 male 3 | ||
| 1650 male 4 | ||
| 1599 male 5 | ||
| 1594 male 6 | ||
| 1570 male 7 | ||
| 1581 male 8 | ||
| 1579 male 9 | ||
| 1569 male 10 | ||
| 1573 male 11 | ||
| 1571 male 12 | ||
| 1617 male 13 | ||
| 1589 male 14 | ||
| 1605 male 15 | ||
| 1608 male 16 | ||
| 1959 male 17 | ||
| 1942 male 18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job