Question: Using the dataset here: https://archive.ics.uci.edu/ml/machine-learning-databases/adult/ (Using adult.data set here) I'm having trouble with several parts of my code: A) What is the maximum number of

Using the dataset here: https://archive.ics.uci.edu/ml/machine-learning-databases/adult/

(Using adult.data set here)

I'm having trouble with several parts of my code:

A) What is the maximum number of hours a person works per week (hours-per-week feature)? How many people work such a number of hours, and what is the percentage of those who earn a lot (>50K) among them?

MY CODE BELOW:

max_load = data["hours per week"].max() print("Max time - {0} hours./week.".format(max_load))

num_workaholics = data[data["hours per week"] == max_load].shape[0] print("Total number of such hard workers {0}".format(num_workaholics))

rich_share = ( float( data[(data["hours per week"] == max_load) & (data["salary"] == ">50K")].shape[0] ) / num_workaholics )

(100 * rich_share) print("Percentage of rich among them {0}%".format(int(100 * rich_share)))

#The issue here is that for some reason the % of rich among them isn't printing (the last line of code)

B) According to our data, on average who earns the most money?

Options: The young, the old, both young and old, and not sure.

Use your own judgement to classify age as listed in the options. Give a detailed explanation and interpretation of the results.

I wanted to see what the age range was, but I'm struggling how to proceed from here

maxValues = data.age.max() print(maxValues) minValues = data.age.min() print(minValues)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!