Skip to content

burton-doherty submission#8

Open
timaburton wants to merge 4 commits into
lyy005:masterfrom
timaburton:master
Open

burton-doherty submission#8
timaburton wants to merge 4 commits into
lyy005:masterfrom
timaburton:master

Conversation

@timaburton

Copy link
Copy Markdown

No description provided.

Comment thread ex5.py
@@ -0,0 +1,33 @@
###Exercise 5-1###
import pandas as pd
wages=pd.read_table("wages.csv",",")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you can just use read_csv:
wages=pandas.read_csv("wages.csv")

Comment thread ex5.py
import pandas as pd
wages=pd.read_table("wages.csv",",")
gen_years=wages.iloc[0:len(wages),0:2]
gen_years=gen_years.sort_values(by=['gender','yearsExperience'], ascending=[1,1])

@lyy005 lyy005 Oct 5, 2017

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question was asking to print out only the unique combinations. You can use drop_duplicates to only keep the unique combinations:
unique_genderYears=genderYears.drop_duplicates()

-0.25

Comment thread ex5.py
###Exercise 5-2###
import pandas as pd
wages=pd.read_table("wages.csv",",")
wage_low=wages.iloc[0:len(wages),[0,1,3]]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you can use:
wage_low=wages.iloc[:,[0,1,3]]

Comment thread ex5.py
wage_high=wage_high.sort_values(by=['wage'], ascending=[0])
print ("The highest wage in both genders is:")
print (wage_high[:1])

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

Comment thread ex5.py
print ("The highest wage in both genders is:")
print (wage_high[:1])

wages_10=wage.high.iloc[0:10,0:2]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wage.high should be wage_high

Comment thread ex5.py
yes_college=min(wages.wage[wages.yearsSchool==16])

print("The minimum wage for non college grads is", no_college)
print("The minimum wage for college grads is", yes_college)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants