Question
Using Python and only the Pandas library: 1) Assume a CSV file (named: absent.csv) contains records with the following headings: ID, Reason for absence, and
Using Python and only the Pandas library:
1) Assume a CSV file (named: absent.csv) contains records with the following headings: ID, Reason for absence, and Social smoker, Number of pets, Hours absent. Each column contains integer values and the 'Social smoker' column can be either a '1' or '0' (smoker or non-smoker, respectively).
a) Find the top 3 most common reasons for absence for the social smokers, and then do the same for the non-smokers. (If there is a tie for 3rd place, include all that tied for that position). You may NOT use any loops. Print the results.
b) Find the mean number of hours absent for the records of those who have no pets, then do the same for those who have more than one pet. Print the results.
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