Python Pandas DataFrames Sorting, Summing and Fetching Max Data
The best way to do when you are learning is to try it. 
It's very unlikely your data will be too large (there aren't millions of car models), but in any case, you can use df.head(N) to take the top N rows to try your method and see if it's slow.
Other useful functions include df.groupby, df.nlargest, df.sort_values
I have just started learning Python, Pandas and NumPy and I want to find out what is the cleanest and most efficient way to solve the following problem.
I have data which holds CarManufacturer, Car, TotalCarSales, bearing in mind that the data is not small:
CarManufacturer Car TotalCarSales
Volkswagen Polo 100 
Volkswagen Golf 50 
Honda Jazz 40 
Honda Civic 100
Question:
Which manufacturer sold the most cars according to it's top 3 best sellers?
I'm struggling to solve this efficiently. I want to avoid iterating over the data. 
My thoughts:
- Load Data into DataFrame
- Index data according to CarManufacturer, Car, TotalCarSales
- Do I want to do a sort here? That would be slow? 
- Create a new DataFrame which has CarManufacturer, TotalSales. For each CarManufacturer I would need to get the top 3 TotalCarSales and take their sum - Is there a way of doing this without iterating over all records in DataFrame? What is best way to fetch the top 3? 
- Then if I sort the TotalSales and take the top 3, wouldn't the sort be slow? Is there a more efficient way?