Reputation: 353
I have been trying to find the display the top 10 companies from the list of 2000 based on a particular column. but the issue is when I input the variable to display the data set, it shows the index and I wanted to know is this can be done without using Print statement.
My current code is
forbes_global = pd.read_csv("Forbes_Global_2000_2019.csv")
profit_assest_company=forbes_global[['Company','Profits as % of Assets']]
profit_assest_company.sort_values(by=['Profits as % of Assets'],ascending=False).head(10)
The current output which I am getting is:
The desired output which I want is:
Can anyone help me with this?
Upvotes: 0
Views: 271
Reputation: 3010
You can use pandas styling to hide the index in a jupyter notebook
(
profit_assest_company
.sort_values(by=['Profits as % of Assets'], ascending=False)
.head(10)
).style.hide_index()
Upvotes: 1