Question: Driving right ( 1 ) Remember that cars dataset, containing the cars per 1 0 0 0 people ( cars _ per _ cap )
Driving right
Remember that cars dataset, containing the cars per people carspercap and whether people drive right drivesright for different countries country The code that imports this data in CSV format into Python as a DataFrame is included in the script.
In the video, you saw a stepbystep approach to filter observations from a DataFrame based on boolean arrays. Let's start simple and try to find all observations in cars where drivesright is True.
drivesright is a boolean column, so you'll have to extract it as a Series and then use this boolean Series to select observations from cars.
Instructions
XP
Extract the drivesright column as a Pandas Series and store it as dr
Use dr a boolean Series, to subset the cars DataFrame. Store the resulting selection in sel.
Print sel, and assert that drivesright is True for all observations.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
