Filter observations from a DataFrame based on boolean arrays: Part 2
Thu Nov 25 2021 10:29:37 GMT+0000 (Coordinated Universal Time)
Saved by @Sourabh #numpy #booleans_in_numpy
Select the cars_per_cap column from cars as a Pandas Series and store it as cpc. Use cpc in combination with a comparison operator and 500. You want to end up with a boolean Series that's True if the corresponding country has a cars_per_cap of more than 500 and False otherwise. Store this boolean Series as many_cars. Use many_cars to subset cars, similar to what you did before. Store the result as car_maniac. Print out car_maniac to see if you got it right.
Comments