The following link is to the colab notebook I am using, the code I am talking about is the last one I have the following table which I have already put in descending order for the column "protein". What I need to have is those first 15 results (the highest 15 protein results) but now in ascending or descending order of the column "calories".
All I have for now is the following code for putting "protein" in descending order.
df1 = df.sort_values(by = ['protein', 'calories'], inplace = True, ascending = [False, True])
df.head(15)
This code will only put one column in ascending /desceding order.
Now that I have my column "protein" in desending order, so highest first, I need these first 15 rows and I need to get rid of the rest if possible and with these 15 I now need to put them in ascending /descending order of "calorie" but I have not been able to drop the rest of the data or sort it without.
Hope someone can help.. sorry for so much text. (first time)
I have tried fixing it with df1.head() but I get the following error: AttributeError: 'NoneType' object has no attribute 'head'
Thanks!!