Project Description¶
An essential part of business is planning for the future and ensuring the business survives changing market conditions. In this project, we explored data from BusinessFinancing.co.uk on the world's oldest businesses. We answered some questions about historic businesses.
In [20]:
# import the required libraries
import pandas as pd
import matplotlib.pyplot as plt
In [44]:
# load the datasets
business = pd.read_csv('businesses.csv')
country = pd.read_csv('countries.csv')
category = pd.read_csv('categories.csv')
In [45]:
# The data came with index column, therefore we are dropping it to avoid repetition in columns
business = business.drop('index', axis =1)
country = country.drop('index', axis =1)
category = category.drop('index', axis =1)
In [46]:
# viewing the first few rows of datasets
business.head()
Out[46]:
business | year_founded | category_code | country_code | |
---|---|---|---|---|
0 | Hamoud Boualem | 1878 | CAT11 | DZA |
1 | Communauté Électrique du Bénin | 1968 | CAT10 | BEN |
2 | Botswana Meat Commission | 1965 | CAT1 | BWA |
3 | Air Burkina | 1967 | CAT2 | BFA |
4 | Brarudi | 1955 | CAT9 | BDI |
In [47]:
country.head()
Out[47]:
country_code | country | continent | |
---|---|---|---|
0 | AFG | Afghanistan | Asia |
1 | AGO | Angola | Africa |
2 | ALB | Albania | Europe |
3 | AND | Andorra | Europe |
4 | ARE | United Arab Emirates | Asia |
In [48]:
category.head()
Out[48]:
category_code | category | |
---|---|---|
0 | CAT1 | Agriculture |
1 | CAT2 | Aviation & Transport |
2 | CAT3 | Banking & Finance |
3 | CAT4 | Cafés, Restaurants & Bars |
4 | CAT5 | Conglomerate |
The dataset was already in the fine form, therefore we do not need to pre process the datasets. We wil begin exploring. First we will explore the oldest business on every continent¶
In [49]:
# merge the country and business data
business_country = business.merge(country, on = 'country_code')
business_continent = business_country.groupby('continent').agg({'year_founded' : 'min'})
business_continent
Out[49]:
year_founded | |
---|---|
continent | |
Africa | 1772 |
Asia | 578 |
Europe | 803 |
North America | 1534 |
Oceania | 1809 |
South America | 1565 |
We will now go in more depth to see the oldest business on each continent, country and the year it was founded¶
In [50]:
old_business_continent_country = business_country.merge(business_continent, on = ['continent', 'year_founded'])
old_business_continent_country[['business', 'continent', 'country', 'year_founded']]
Out[50]:
business | continent | country | year_founded | |
---|---|---|---|---|
0 | Mauritius Post | Africa | Mauritius | 1772 |
1 | Kongō Gumi | Asia | Japan | 578 |
2 | St. Peter Stifts Kulinarium | Europe | Austria | 803 |
3 | La Casa de Moneda de México | North America | Mexico | 1534 |
4 | Casa Nacional de Moneda | South America | Peru | 1565 |
5 | Australia Post | Oceania | Australia | 1809 |
Exploring how many countries per continent do not have data on oldest business¶
In [55]:
all_countries = business.merge(country, on='country_code', how='outer', indicator=True)
missing_countries = all_countries[all_countries['_merge'] != 'both']
missing_countries.groupby('continent').agg({'country':'count'})
Out[55]:
country | |
---|---|
continent | |
Africa | 3 |
Asia | 7 |
Europe | 2 |
North America | 6 |
Oceania | 11 |
South America | 3 |
What is the oldest business category on each continent and which year was it founded in?¶
In [70]:
business_category = business.merge(category, on = 'category_code')
business_category_country =business_category.merge(country, on='country_code' )
business_category_country.groupby(['continent', 'category']).agg({'year_founded': 'min'})
Out[70]:
year_founded | ||
---|---|---|
continent | category | |
Africa | Agriculture | 1947 |
Aviation & Transport | 1854 | |
Banking & Finance | 1892 | |
Distillers, Vintners, & Breweries | 1933 | |
Energy | 1968 | |
Food & Beverages | 1878 | |
Manufacturing & Production | 1820 | |
Media | 1943 | |
Mining | 1962 | |
Postal Service | 1772 | |
Asia | Agriculture | 1930 |
Aviation & Transport | 1858 | |
Banking & Finance | 1830 | |
Cafés, Restaurants & Bars | 1153 | |
Conglomerate | 1841 | |
Construction | 578 | |
Defense | 1808 | |
Distillers, Vintners, & Breweries | 1853 | |
Energy | 1928 | |
Food & Beverages | 1820 | |
Manufacturing & Production | 1736 | |
Media | 1931 | |
Mining | 1913 | |
Postal Service | 1800 | |
Retail | 1883 | |
Telecommunications | 1885 | |
Tourism & Hotels | 1584 | |
Europe | Agriculture | 1218 |
Banking & Finance | 1606 | |
Cafés, Restaurants & Bars | 803 | |
Consumer Goods | 1649 | |
Defense | 1878 | |
Distillers, Vintners, & Breweries | 862 | |
Manufacturing & Production | 864 | |
Media | 1999 | |
Medical | 1422 | |
Mining | 1248 | |
Postal Service | 1520 | |
Telecommunications | 1912 | |
Tourism & Hotels | 1230 | |
North America | Agriculture | 1638 |
Aviation & Transport | 1870 | |
Banking & Finance | 1891 | |
Distillers, Vintners, & Breweries | 1703 | |
Food & Beverages | 1920 | |
Manufacturing & Production | 1534 | |
Media | 1909 | |
Retail | 1670 | |
Tourism & Hotels | 1770 | |
Oceania | Banking & Finance | 1861 |
Postal Service | 1809 | |
South America | Banking & Finance | 1565 |
Cafés, Restaurants & Bars | 1877 | |
Defense | 1811 | |
Food & Beverages | 1660 | |
Manufacturing & Production | 1621 |