Visualizing companies and its profits in 2000, according to Forbes magazine

companies_profits_2000
In [1]:
# Visualizing companies and its profits in 2000, according to Forbes magazine.
In [2]:
import numpy as np
import pandas as pd
from collections import Counter
from pandas import Series, DataFrame
In [3]:
# Reading the file:
data = pd.read_csv('Forbes2000.csv', nrows=20, index_col=0)
data
Out[3]:
rank name country category sales profits assets marketvalue
1 1 Citigroup United States Banking 94.71 17.85 1264.03 255.30
2 2 General Electric United States Conglomerates 134.19 15.59 626.93 328.54
3 3 American Intl Group United States Insurance 76.66 6.46 647.66 194.87
4 4 ExxonMobil United States Oil & gas operations 222.88 20.96 166.99 277.02
5 5 BP United Kingdom Oil & gas operations 232.57 10.27 177.57 173.54
6 6 Bank of America United States Banking 49.01 10.81 736.45 117.55
7 7 HSBC Group United Kingdom Banking 44.33 6.66 757.60 177.96
8 8 Toyota Motor Japan Consumer durables 135.82 7.99 171.71 115.40
9 9 Fannie Mae United States Diversified financials 53.13 6.48 1019.17 76.84
10 10 Wal-Mart Stores United States Retailing 256.33 9.05 104.91 243.74
11 11 UBS Switzerland Diversified financials 48.95 5.15 853.23 85.07
12 12 ING Group Netherlands Diversified financials 94.72 4.73 752.49 54.59
13 13 Royal Dutch/Shell Group Netherlands/ United Kingdom Oil & gas operations 133.50 8.40 100.72 163.45
14 14 Berkshire Hathaway United States Insurance 56.22 6.95 172.24 141.14
15 15 JP Morgan Chase United States Banking 44.39 4.47 792.70 81.94
16 16 IBM United States Technology hardware & equipment 89.13 7.58 104.46 171.54
17 17 Total France Oil & gas operations 131.64 8.84 87.84 116.64
18 18 BNP Paribas France Banking 47.74 4.73 745.09 59.29
19 19 Royal Bank of Scotland United Kingdom Banking 35.65 4.95 663.45 90.21
20 20 Freddie Mac United States Diversified financials 46.26 10.09 752.25 44.25
In [4]:
# Extracting company names and its profits:
company_names = data['name']
company_profits = data['profits']

print(company_names)
1                   Citigroup
2            General Electric
3         American Intl Group
4                  ExxonMobil
5                          BP
6             Bank of America
7                  HSBC Group
8                Toyota Motor
9                  Fannie Mae
10            Wal-Mart Stores
11                        UBS
12                  ING Group
13    Royal Dutch/Shell Group
14         Berkshire Hathaway
15            JP Morgan Chase
16                        IBM
17                      Total
18                BNP Paribas
19     Royal Bank of Scotland
20                Freddie Mac
Name: name, dtype: object
In [5]:
print(company_profits)
1     17.85
2     15.59
3      6.46
4     20.96
5     10.27
6     10.81
7      6.66
8      7.99
9      6.48
10     9.05
11     5.15
12     4.73
13     8.40
14     6.95
15     4.47
16     7.58
17     8.84
18     4.73
19     4.95
20    10.09
Name: profits, dtype: float64
In [6]:
# Visualizing the data:
import matplotlib.pyplot as plt
In [9]:
plt.style.use("ggplot")
plt.figure(figsize=(14, 14))

plt.barh(company_names, company_profits)
plt.title("Companies.Forbes 2000")
#plt.ylabel("Companies")
plt.xlabel("Profits")

plt.show()
In [8]:
# We can see that ExxonMobil and Citigroup, were two of the most profitable companies in 2000.

Comments