-
Notifications
You must be signed in to change notification settings - Fork 11
corley-kilgore submission #3
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
Open
mcorley1
wants to merge
7
commits into
lyy005:master
Choose a base branch
from
mcorley1:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
575051f
initial commit of part 1
mcorley1 b216583
second commit of exercise 5, part 1
mcorley1 60c00c9
second commit of excercise 5 code
mcorley1 69fef0d
Exercise 5 Challenge Part 2 1st commit
kkilgoreND 5bacc1a
1st Commit for Part 3 of Exercise 5 Challenge
kkilgoreND 97410a6
Updated Exercise_5_Part_3.py
kkilgoreND c02fb39
Scripts for Parts 1-3
kkilgoreND File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .DS_Store | ||
| *.pptx | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #Completing Part 1 | ||
| import pandas #loading the pandas package to use data frames | ||
|
|
||
| data = pandas.read_csv("wages.csv", header=0,sep=",") #loads the file | ||
|
|
||
| gender_yrsexp = data.iloc[:,0:2] #subsets data by selecting the first two columns | ||
|
|
||
| uniquegender = gender_yrsexp.drop_duplicates() #drops duplicates, like the unique function in unix | ||
| uniquegender.shape #displays shape of array | ||
|
|
||
| sortgender = uniquegender.sort_values(["gender","yearsExperience"]) | ||
|
|
||
| sortgender.to_csv("part1done.txt", sep=" ") | ||
|
|
||
| #Completing Part 2 | ||
| import pandas | ||
| df=pandas.read_csv('wages.csv') | ||
| #df=wages.csv data | ||
|
|
||
| #Highest earner | ||
| highest_earner=df.nlargest(1,'wage') | ||
| #output is under highest_earner (male,5,11,39.808917197) | ||
|
|
||
| #Lowest earner | ||
| lowest_earner=df.nsmallest(1,'wage') | ||
| #Output is under lowest_earner (female,9,11,0.07655561) | ||
|
|
||
| #Number of females in the top 10 | ||
| num_of_females=df[df['wage']>=df['wage'].nlargest(10).iloc[-1]]['gender'].eq('female').sum() | ||
| #Output is under num_of_females (=2) | ||
|
|
||
|
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. Good job |
||
| #Completing Part 3 | ||
| import pandas | ||
|
|
||
| #Define wages | ||
| wages=pandas.read_csv('wages.csv') | ||
|
|
||
| #Select for the people who didn't finish school(i.e. 12yrs of school) | ||
| education12=wages[wages.yearsSchool==12] | ||
|
|
||
| #Calculate the minimum wage for people with 12yrs of school | ||
| minimum12=min(education12.wage) | ||
|
|
||
| #Select for the people who did finish school(i.e. 16yrs of school) | ||
| education16=wages[wages.yearsSchool==16] | ||
|
|
||
| #Calculate the minimum wage for people with 16yrs of school | ||
| minimum16=min(education16.wage) | ||
|
|
||
| #Calculate the difference between the minimum wage for those who finished school vs. those who didn't | ||
| print(minimum16-minimum12) | ||
| #Difference is 4.0816223772 | ||
|
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. Good job |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import pandas | ||
| df=pandas.read_csv('wages.csv') | ||
| #df=wages.csv data | ||
|
|
||
| #Highest earner | ||
| highest_earner=df.nlargest(1,'wage') | ||
| #output is under highest_earner (male,5,11,39.808917197) | ||
|
|
||
| #Lowest earner | ||
| lowest_earner=df.nsmallest(1,'wage') | ||
| #Output is under lowest_earner (female,9,11,0.07655561) | ||
|
|
||
| #Number of females in the top 10 | ||
| num_of_females=df[df['wage']>=df['wage'].nlargest(10).iloc[-1]]['gender'].eq('female').sum() | ||
| #Output is under num_of_females (=2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import pandas | ||
| #Define wages | ||
| wages=pandas.read_csv('wages.csv') | ||
|
|
||
| #Select for the people who didn't finish school(i.e. 12yrs of school) | ||
| education12=wages[wages.yearsSchool==12] | ||
|
|
||
| #Calculate the minimum wage for people with 12yrs of school | ||
| minimum12=min(education12.wage) | ||
|
|
||
| #Select for the people who did finish school(i.e. 16yrs of school) | ||
| education16=wages[wages.yearsSchool==16] | ||
|
|
||
| #Calculate the minimum wage for people with 16yrs of school | ||
| minimum16=min(education16.wage) | ||
|
|
||
| #Calculate the difference between the minimum wage for those who finished school vs. those who didn't | ||
| print(minimum16-minimum12) | ||
| #Difference is 4.0816223772 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #completing exercise5 | ||
| import pandas #loading the pandas package to use data frames | ||
|
|
||
| data = pandas.read_csv("wages.csv", header=0,sep=",") #loads the file | ||
|
|
||
| #completing part1 | ||
| gender_yrsexp = data.iloc[:,0:2] #subsets data by selecting the first two columns | ||
|
|
||
| uniquegender = gender_yrsexp.drop_duplicates() #drops duplicates, like the unique function in unix | ||
| uniquegender.shape #displays shape of array | ||
|
|
||
| sortgender = uniquegender.sort_values(["gender","yearsExperience"]) | ||
|
|
||
| sortgender.to_csv("part1done.txt", sep=" ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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