Analysis of Africa’s 250 Largest Companies Using Libreoffice Calc and Python

Analyzing 250 Top Companies in Africa with Libreoffice Calc, Python and Pandas

Author
Affiliations

John Karuitha

Karatina University, School of Business

Graduate School of Business Administration, University of the Witwatersrand

Published

September 5, 2023

Modified

September 5, 2023

1 Background

Recently. I published a data analysis project titled Navigating Africa’s Business Landscape Using Python in my Rpubs site. The analysis provoked quite a bit of interest that motivated me to go a little deeper into analyzing the corporate landscape in Africa. In this mopre comprehensive analysis project, I use updated data from the Africa Business to explore the 250 largest formal corporations in Africa 1. The data captures the revenue, net income, and market valuation for the of the 250 largest companies in Africa for the years 2022 and 2023(Kagle, 2023).

NB: ALL FIGURES ARE IN MILLIONS OF US DOLLARS

Tip

Please visit my rpubs site to see more data projects. Alternatively, copy and paste the link <www.rpubs.com/Karuitha> into your browser. You can also view my linkedin site for my skills and education.

My Tableau public profile contains my data visualizations.

My Shiny web apps are available on this site. You can copy-paste this web address instead https://karuitha.shinyapps.io

Tip

Skills & Technologies Applied: Python, Pandas, Matplotlib, Quarto, Data Science.

2 Objectives

The primary objective of the analysis is to explore the corporate environment in Africa.

Specifically, we examine the following matters.

  1. Which are the top ranking companies in Africa in 2022 and 2023?
  2. Which companies have the best financial performance in 2022 and 2023?
  3. Which countries have the highest concentration of companies in the top 250 largest corporations in Africa?
  4. Which industries have the highest concentration of companies in the top 250 largest corporations in Africa?
  5. What is the correlation between market value of a company on the one hand and revenues and profits on the other?
  6. Which company has the highest rise in market value between 2022 and 2023.
  7. Which company has the highest rise in ranking between 2022 and 2023.

3 Key Findings

  1. 75% of the top 20 companies are domiciled in South Africa.
  2. 38% of the top 250 companies are domiciled in South Africa.
  3. The largest company in Africa is Naspers with USD 49,619,000,000, USD 80,865,000,000, USD 7,940,000,000, and USD 12,000,000 in market value (2023), market value (2022), revenue, and profits respectively.
  4. Outside South Africa, Morocco, Nigeria, and Egypt are the biggest players in Africa’s corporate landscape.
  5. Outside South Africa, MTN Nigeria and Dangote cement are the largest companies in South Africa.
  6. Safaricom of Kenya is the 25th largest company in Africa, and the sixth largest company in Africa outside South Africa.
  7. The top 250 companies operate in telecommunications, non-energy materials, and finance sectors.
  8. Revenues have a higher correlation with company value compared to profits.
  9. FDH Bank of Malawi has the largest increase in market value between 2022 and 2023, a whooping 100%.
  10. Arcelormittal South Africa has risen 111 positions in the continental corporate rankings.

4 Word of Caution

The analysis excludes privately held companies (that are not listed in stock exchanges). Hence, we may not have a complete picture of business in Africa. Nevertheless, we postulate that listed companies will, on average be larger than privately held companies. Thus, although the data is not complete, it still allows for a meaningful analysis of business in Africa.

5 Data

I scrape the data using Libreoffice calc. Libreoffice calc is the equivalent of Ms Excel except that it is open source- that is, free to download and use. Next, I load the required python packages and read in the data 2.

```{python}
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
```

Python has captured the variables ranking2022 and market_value_2022 as text rather than numeric values. To correct this anomaly, we convert these variables to the appropriate data format. Likewise the country Botswana is also written in all upper case BOTSWANA (Borjigin, 2023; VanderPlas, 2016).

```{python}
## Read in the data
africa = pd.read_excel("africa250.xlsx")

africa.sort_values(by = "ranking2023", inplace = True)

## Reset the index
africa.reset_index(inplace=True)

## Update the country BOTSWANA to Botswana as there are mixed cases.
africa["stock_exchange"].replace(["BOTSWANA"], ["Botswana"], inplace = True)

africa["ranking2022"] = pd.to_numeric(africa["ranking2022"], errors = "coerce")

africa["market_value_22"] = pd.to_numeric(africa["market_value_22"], errors = "coerce")


## Add column for change in market value from 2022 to 2023
africa["mv_rise"] = africa["market_value23"] - africa["market_value_22"]

## Add column for rise in ranking from 2022 to 2023
africa["ps_rise"] = africa["ranking2023"] - africa["ranking2022"]

## View the first few columns of the data
africa.head(10)
```
index ranking2023 ranking2022 name sector stock_exchange market_value_22 market_value23 revenue_latest net_income_latest mv_rise ps_rise
0 100 1 1.0 Naspers Consumer Non-Cyclicals South Africa 49619.0 80865 7940.0 12.0 31246.0 0.0
1 101 2 3.0 FirstRand Finance South Africa 29739.0 19090 6178.0 2.0 -10649.0 -1.0
2 102 3 5.0 Standard Bank Group Finance South Africa 20915.0 16347 7183.0 2.0 -4568.0 -2.0
3 103 4 6.0 Vodacom Group Telecommunications South Africa 20102.0 14292 6334.0 1.0 -5810.0 -2.0
4 104 5 2.0 Anglo American Platinum Non-Energy Materials South Africa 36429.0 14265 9056.0 3.0 -22164.0 3.0
5 105 6 4.0 MTN Group Telecommunications South Africa 24500.0 13537 11381.0 1.0 -10963.0 2.0
6 106 7 10.0 Gold Fields Non-Energy Materials South Africa 13909.0 11936 4287.0 711.0 -1973.0 -3.0
7 107 8 7.0 Capitec Bank Holdings Finance South Africa 18604.0 11044 1861.0 587.0 -7560.0 1.0
8 108 9 18.0 MTN Nigeria Telecommunications Nigeria 10471.0 10602 4370.0 779.0 131.0 -9.0
9 109 10 20.0 AngloGold Ashanti Non-Energy Materials South Africa 10032.0 10196 4501.0 297.0 164.0 -10.0

6 Data Exploration

6.1 Variables, Observations, and Data Types

Lets us check the variables and observations present in the data. There are 250 observations of 9 variables.

```{python}
africa.info()
```
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 250 entries, 0 to 249
Data columns (total 12 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   index              250 non-null    int64  
 1   ranking2023        250 non-null    int64  
 2   ranking2022        226 non-null    float64
 3   name               250 non-null    object 
 4   sector             250 non-null    object 
 5   stock_exchange     250 non-null    object 
 6   market_value_22    246 non-null    float64
 7   market_value23     250 non-null    int64  
 8   revenue_latest     171 non-null    float64
 9   net_income_latest  175 non-null    float64
 10  mv_rise            246 non-null    float64
 11  ps_rise            226 non-null    float64
dtypes: float64(6), int64(3), object(3)
memory usage: 23.6+ KB

The variables in the data are the following.

```{python}
africa.columns.values
```
array(['index', 'ranking2023', 'ranking2022', 'name', 'sector',
       'stock_exchange', 'market_value_22', 'market_value23',
       'revenue_latest', 'net_income_latest', 'mv_rise', 'ps_rise'],
      dtype=object)
  • Ranking2023: The company ranking by market value in 2023.
  • Ranking2022: The company ranking by market value in 2022.
  • Name: The company name.
  • Sector: The company sector of business operations.
  • Stock exchange: The stock exchange where company stocks are listed.
  • Market_value_22: The company market value in 2022.
  • Market_value_23: The company market value in 2023.
  • Revenue_latest: Latest reported company annual revenues.
  • Net_income_latest: Latest reported company net income.
```{python}
africa.info()
```
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 250 entries, 0 to 249
Data columns (total 12 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   index              250 non-null    int64  
 1   ranking2023        250 non-null    int64  
 2   ranking2022        226 non-null    float64
 3   name               250 non-null    object 
 4   sector             250 non-null    object 
 5   stock_exchange     250 non-null    object 
 6   market_value_22    246 non-null    float64
 7   market_value23     250 non-null    int64  
 8   revenue_latest     171 non-null    float64
 9   net_income_latest  175 non-null    float64
 10  mv_rise            246 non-null    float64
 11  ps_rise            226 non-null    float64
dtypes: float64(6), int64(3), object(3)
memory usage: 23.6+ KB

6.2 Missing Values

We examine the missing values in the variables. For the rankings, all the missing values relate to new entrants in the data. For instance, a company may have entered the list of 250 companies in 2023. Hence, ranking for 2022 is a missing value. Likewise, a company may hae been ranked in 2022 but dropped out of the ranking of 250 companies in 2023.

```{python}
[col for col in africa.columns if africa[col].isnull().any()]
```
['ranking2022',
 'market_value_22',
 'revenue_latest',
 'net_income_latest',
 'mv_rise',
 'ps_rise']

We see the columns that have missing values. Our interest is in revenues and net income.

```{python}
africa.isna().sum()
```
index                 0
ranking2023           0
ranking2022          24
name                  0
sector                0
stock_exchange        0
market_value_22       4
market_value23        0
revenue_latest       79
net_income_latest    75
mv_rise               4
ps_rise              24
dtype: int64
```{python}
plt.style.use("fivethirtyeight")
africa.isna().sum().sort_values(ascending=False).plot(kind = "barh",
title = "Missing values", color = "blue")
plt.ylabel("Variable")
plt.show()
```

6.3 Data Exploration

We explore the data using the seaborn pairs plots. The first analysis visualises pertinent variables by country.

```{python}
sns.pairplot(africa[["stock_exchange", "sector", "market_value_22", "market_value23",
"revenue_latest", "net_income_latest", "ps_rise", "mv_rise"]], hue = "stock_exchange", palette = "colorblind", corner = True, dropna = True)
```

We note, as expected, a substatial correlation between revenues and profits with market values. The correlation varies across countries.

Let us the same analysis for market sectors. Again we see the variation across sectors.

```{python}
sns.pairplot(africa[["stock_exchange", "sector", "market_value_22", "market_value23",
"revenue_latest", "net_income_latest"]], hue = "sector", palette = "colorblind", corner = True, dropna = True)
```

7 Answering Pertinent Questions

7.1 Which are the top 20 ranked companies in Africa?

In this section, I concentrate on the top 20 companies in Africa. The top company for 2 years running is Naspers of South Africa, a company dealing in consumer non-cyclicals. First Rand Bank and Standard Bank Group from South Africa come a distant second.

```{python}
africa[["name","sector","stock_exchange",
"market_value_22","market_value23",
"revenue_latest", "net_income_latest"]].head(20)
```
name sector stock_exchange market_value_22 market_value23 revenue_latest net_income_latest
0 Naspers Consumer Non-Cyclicals South Africa 49619.0 80865 7940.0 12.0
1 FirstRand Finance South Africa 29739.0 19090 6178.0 2.0
2 Standard Bank Group Finance South Africa 20915.0 16347 7183.0 2.0
3 Vodacom Group Telecommunications South Africa 20102.0 14292 6334.0 1.0
4 Anglo American Platinum Non-Energy Materials South Africa 36429.0 14265 9056.0 3.0
5 MTN Group Telecommunications South Africa 24500.0 13537 11381.0 1.0
6 Gold Fields Non-Energy Materials South Africa 13909.0 11936 4287.0 711.0
7 Capitec Bank Holdings Finance South Africa 18604.0 11044 1861.0 587.0
8 MTN Nigeria Telecommunications Nigeria 10471.0 10602 4370.0 779.0
9 AngloGold Ashanti Non-Energy Materials South Africa 10032.0 10196 4501.0 297.0
10 Dangote Cement Non-Energy Materials Nigeria 11203.0 9986 3512.0 830.0
11 Absa Group Finance South Africa 11048.0 8686 5438.0 1.0
12 Sasol Non-Energy Materials South Africa 15354.0 8638 17920.0 2.0
13 Attijariwafa Bank Finance Morocco 10250.0 8335 2528.0 582.0
14 Kumba Iron Ore Non-Energy Materials South Africa 14446.0 8163 4058.0 988.0
15 Impala Platinum Holdings Non-Energy Materials South Africa 13062.0 7874 6842.0 2.0
16 Bid Corp Consumer Services South Africa 7300.0 7533 8686.0 289.0
17 Shoprite Holdings Consumer Non-Cyclicals South Africa 9577.0 7408 10658.0 331.0
18 Maroc Telecom Telecommunications Morocco 11782.0 7307 3454.0 266.0
19 BUA Cement Non-Energy Materials Nigeria 5759.0 7192 620.0 217.0

Notable is that 15 of the companies in the top 20 are from South Africa. That is a ratio of 75%.

```{python}
africa[["name","sector","stock_exchange",
"market_value_22","market_value23",
"revenue_latest", "net_income_latest"]].head(20)["stock_exchange"].value_counts().plot(kind = "pie", title = "Domicile of Top 20 Companies in Africa", autopct = "%1.0f%%")
```
<AxesSubplot:title={'center':'Domicile of Top 20 Companies in Africa'}, ylabel='stock_exchange'>

Which industries have the most companies in the top 20? The chart below shows shows that companies in the non-energy materials and finance dominate the top 20 with 40% and 25% shares, respectively.

```{python}
africa[["name","sector","stock_exchange",
"market_value_22","market_value23",
"revenue_latest", "net_income_latest"]].head(20)["sector"].value_counts().plot(kind = "pie", title = "Top 20 Companies in Africa by Sector", autopct = "%1.0f%%")
```
<AxesSubplot:title={'center':'Top 20 Companies in Africa by Sector'}, ylabel='sector'>

7.2 Which are the top 20 ranked companies in Africa (Outside South Africa)?

Given the dominance of South Africa in the sample, I create a subset of data that excludes companies from South Africa and rerun the analysis.The aim is to list the top 20 companies in Africa not domiciled in South Africa.

Outside South Africa, the top companies in Africa are MTN Nigeria followed by Dangote Cement. Safaricom of Kenya is sixth in the list and 24th in the top 250 companies in Africa.

```{python}
africa[africa["stock_exchange"] != "South Africa"][["name", "stock_exchange"]].head(20)
```
name stock_exchange
8 MTN Nigeria Nigeria
10 Dangote Cement Nigeria
13 Attijariwafa Bank Morocco
18 Maroc Telecom Morocco
19 BUA Cement Nigeria
24 Safaricom Kenya
26 Commercial International Bank Egypt
27 Airtel Africa Nigeria
30 Banque Centrale Populaire Morocco
32 B2gold Corp Namibia
33 BUA Foods Nigeria
38 Afreximbank (DRs) Mauritius
39 Bank of Africa (formerly BMCE) Morocco
42 LafargeHolcim Maroc Morocco
47 Sonatel Côte d'Ivoire
50 Managem Morocco
52 Orange Côte d'Ivoire Côte d'Ivoire
55 TAQA Morocco Morocco
59 Nestle Nigeria Nigeria
61 Abou Kir Fertilizers & Chemicals Egypt

We see that Morocco, Nigeria, and Egypt top the list.

```{python}
africa[africa["stock_exchange"] != "South Africa"][["name", "stock_exchange"]].head(20)["stock_exchange"].value_counts()
```
Morocco          7
Nigeria          6
Egypt            2
Côte d'Ivoire    2
Kenya            1
Namibia          1
Mauritius        1
Name: stock_exchange, dtype: int64
```{python}
africa[africa["stock_exchange"] != "South Africa"][["name", "stock_exchange"]].head(20)["stock_exchange"].value_counts().plot(kind = "pie", title = "Domicile of Top 20 Companies in Africa (Outside South Africa)", autopct = "%1.0f%%")
```
<AxesSubplot:title={'center':'Domicile of Top 20 Companies in Africa (Outside South Africa)'}, ylabel='stock_exchange'>

Outside South Africa, telecommunications, non-energy materials, and finance are the dominant sectors for the top 20 companies.

```{python}
africa[africa["stock_exchange"] != "South Africa"][["name", "sector"]].head(20)["sector"].value_counts()
```
Telecommunications        6
Non-Energy Materials      6
Finance                   5
Consumer Non-Cyclicals    2
Utilities                 1
Name: sector, dtype: int64
```{python}
africa[africa["stock_exchange"] != "South Africa"][["name", "sector"]].head(20)["sector"].value_counts().plot(kind = "pie", title = "Top 20 Companies in Africa (Outside South Africa) by Sector", autopct = "%1.0f%%")
```
<AxesSubplot:title={'center':'Top 20 Companies in Africa (Outside South Africa) by Sector'}, ylabel='sector'>

7.3 Which countries have the highest concentration of companies in the top 250 largest corporations in Africa?

In the previous section, we concentrated on the top 20 largest companies. Here, we examine the entire sample data. Which country has the largest number of companies in the top 250?

We see that South Africa still leads with 38%, followed by Egypt(13%), Morocco (12%), Nigeria and Kenya (9% and 4% respectively).

```{python}
africa["stock_exchange"].value_counts().plot(kind = "pie", title = "Domicile of Top Companies in Africa", autopct = "%1.0f%%")
```
<AxesSubplot:title={'center':'Domicile of Top Companies in Africa'}, ylabel='stock_exchange'>

7.4 Which industries have the highest concentration of companies in the top 250 largest corporations in Africa?

Which industries dominate Africa’s corporate landscape? The figure below that in Africa, the financial sector leads by a wide margin, followed by consumer non-cyclicals, non-energy materials and telecommunications. Perhaps most companies engaged in cosntruction,health, and health care are from outside the continent. There is room fo further analysis.

```{python}
africa["sector"].value_counts().plot(kind = "pie", title = "Top Companies in Africa by Sector", autopct = "%1.0f%%")
```
<AxesSubplot:title={'center':'Top Companies in Africa by Sector'}, ylabel='sector'>

7.5 What is the correlation between market value of a company on the one hand and revenues and profits on the other?

Among the 250 largest companies in Africa, revenues have a stronger correlation with the market value of a company than profits. Although profits do consist of numerous non-cash expenditures, this observation is surprising, especially given that profits have a very mild correlation with the market value of a company.

```{python}
plt.scatter(africa["market_value23"],
africa["revenue_latest"], color = "blue",
label = "Revenues")

plt.scatter(africa["market_value23"],
africa["net_income_latest"], color = "red", label = "Profits")

plt.legend()
plt.xlabel("Market value")
plt.ylabel("Revenues/Profits")
plt.title("Correlation of Revenues/Profits with Market Value")
plt.xticks([0, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000],
labels = ["0K", "10K", "20K", "30K", "40K", "50K", "60K", "70K", "80K"])
plt.show()
```

7.6 Which company has the highest rise in market value between 2022 and 2023.

Let us examine companies that had the highest rise in market value beyween 2022 and 2023. We see that Naspers had a stageering USD 31,246,000,000 rise in market value between 2022 and 2023. Bua cement comes a distant second. It would be interesting to examine the meteoric rise of Nasper.

```{python}
africa.nlargest(10, "mv_rise")[["name", "stock_exchange", "mv_rise"]]
```
name stock_exchange mv_rise
0 Naspers South Africa 31246.0
19 BUA Cement Nigeria 1433.0
33 BUA Foods Nigeria 1410.0
50 Managem Morocco 422.0
93 Banque Internationale Arabe de Tunisie (BIAT) Tunisia 296.0
103 Hosken Consolidated Investments South Africa 278.0
118 National Bank of Malawi Malawi 264.0
156 Illovo Sugar (Malawi) Malawi 256.0
117 Airtel Malawi Malawi 241.0
16 Bid Corp South Africa 233.0

Of importance is the percentage rise in market valuation.

```{python}
africa["perc_mv_rise"] = africa["mv_rise"]/africa["market_value_22"] * 100
```
```{python}
africa.nlargest(10, "perc_mv_rise")[["name","stock_exchange", "perc_mv_rise"]]
```
name stock_exchange perc_mv_rise
230 FDH Bank Malawi 100.763359
218 Abu Dhabi Islamic Bank – Egypt Egypt 96.710526
156 Illovo Sugar (Malawi) Malawi 95.880150
158 Sidi Kerir Petrochemicals Egypt 68.666667
183 FMB Capital Holdings Malawi 66.390041
0 Naspers South Africa 62.971845
33 BUA Foods Nigeria 54.757282
245 Union Internationale de Banques Tunisia 52.830189
205 Fidelity Bank Nigeria 50.672646
118 National Bank of Malawi Malawi 48.708487

The analysis shows that FDH bank of Malawi more than doubled its market value between 2022 and 2023. That is phenomenal. Investors must have laughed all the way to the bank. Notably, only one company in South Africa appears on this list. The observation suggests that there is greater room for growth outside South Africa.

7.7 Which company has the highest rise in ranking between 2022 and 2023.

Arcelormittal South Africa rose 111 positions in the rankings. Transaction capital comes second, having risen 92 places. Perhaps these are the companies investors should be of the lookout for.

```{python}
africa.nlargest(10, "ps_rise")[["name", "stock_exchange", "ps_rise"]]
```
name stock_exchange ps_rise
247 Arcelormittal South Africa South Africa 111.0
151 Transaction Capital South Africa 92.0
241 Cashbuild South Africa 59.0
249 Cleopatra Hospital Egypt 56.0
233 Raubex Group South Africa 54.0
98 Econet Wireless Zimbabwe 52.0
154 Innscor Africa* Zimbabwe 52.0
175 KAP Industrial Holdings South Africa 51.0
238 PPC South Africa 49.0
211 National Bank of Kuwait – Egypt Egypt 47.0

8 Conclusion

In this analysis, I examine the top 250 companies in Africa using data from the business report. The chief findings are as follows:

  1. 75% of the top 20 companies are domiciled in South Africa.
  2. 38% of the top 250 companies are domiciled in South Africa.
  3. The largest company in Africa is Naspers with USD 49,619,000,000, USD 80,865,000,000, USD 7,940,000,000, and USD 12,000,000 in market value (2023), market value (2022), revenue, and profits respectively.
  4. Outside South Africa, Morocco, Nigeria, and Egypt are the biggest players in Africa’s corporate landscape.
  5. Outside South Africa, MTN Nigeria and Dangote cement are the largest companies in South Africa.
  6. Safaricom of Kenya is the 25th largest company in Africa, and the sixth largest company in Africa outside South Africa.
  7. The top 250 companies operate in telecommunications, non-energy materials, and finance sectors.
  8. Revenues have a higher correlation with company value compared to profits.
  9. FDH Bank of Malawi has the largest increase in market value between 2022 and 2023, a whooping 100%.
  10. Arcelormittal South Africa has risen 111 positions in the continental corporate rankings.

More analysis is warranted to identify drivers of business performance on the continent.

References

Borjigin, C. (2023). Python data science. Springer Nature Singapore. https://doi.org/10.1007/978-981-19-7702-2
Kagle. (2023). Top 2000 companies globally. https://www.kaggle.com/datasets/joebeachcapital/top-2000-companies-globally.
VanderPlas, J. (2016). Python data science handbook: Essential tools for working with data. " O’Reilly Media, Inc.".

Footnotes

  1. The data is available on this link https://african.business/2023/05/long-reads/africas-top-250-companies-in-2023-doing-business-in-tough-times↩︎

  2. Libreoffice is available to download,install and use on the site https://www.libreoffice.org/↩︎