Question: Please solve the following python question Example questions: Given two dataFrames as follows and answer questions. df1 City Boston 645,966 New York 8,336,697 POP df2

Please solve the following python question

Please solve the following python question Example questions: Given two dataFrames as

Example questions: Given two dataFrames as follows and answer questions. df1 City Boston 645,966 New York 8,336,697 POP df2 Newspaper City Readers Boston Globe Boston, MA 245,572 New York Times New York, NY 1,865,318 1. List the steps to combine these two dataFrames and create a new one which contains the columns: City, POP, Newspaper, Readers. (Hint: need to modify the column "City" in df2 so that it can join with df1) 2. Write the steps to find the city with highest ratio of readers to population. (Hint: First, set the column 'City' as the index of the new joined dataFrame. Second, calculate the ratio of readers to population. Third, find the maximum ratio and return the index which is a city.)

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!