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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started