1

So one of my task is to take all the cars that were made after certain year and add them all up together. My problem is from the car data, I am able to filter out the correct car year and origin, but when I try to use the count() function it gives me the incorrect numbers.

car_count = cars.loc[(cars['OG'] == 'Japan') & (cars['Year'] > 
1999)].count() 

car_count

OG    24190
Year     24190
Model     24190
Count    24190

If I do not include count() then my output looks something like this

OG    | Year | Maker | Count
Japan | 1997 | Honda | 992
Japan | 1997 | Toyota| 278
US    | 1997 | Ford  | 453
Japan | 1998 | Honda | 2667
Japan | 1998 | Toyota| 213

I have been trying to make my output look like this

Maker
Honda | 3659
Toyota| 491
greatFritz
  • 165
  • 1
  • 14

0 Answers0