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

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!