UK Bank Anaylsis - This study shows the amont of British retail banks and the earliest and last founded Bank
This is imports useful functions from a file
from helper import *
This gets a specific table from wikipedia
url = ('https://en.wikipedia.org/wiki/List_of_banks_in_the_United_Kingdom')
def data_from_url(url, index):
df = pd.read_html(url)[index]
lol = df.to_numpy().tolist()
return lol
data = data_from_url(url,2)
Trimming down the data to extract the pertinent data
index = 0
for row in data:
data[index] = row[:-4]
index += 1
print(data[:])
[['Atom Bank', 2013], ['Bank of Ireland UK', 1783], ['Barclays', 1690], ['HSBC UK', 1865], ['Danske Bank UK', 1824], ['Lloyds Banking Group†[a]', 2009], ['Metro Bank', 2010], ['Monzo', 2015], ['NatWest Group††[b]', 1968], ['Santander Bank', 2010], ['Starling Bank', 2014], ['Tandem Bank', 2015], ['The Cooperative Bank', 1872], ['TSB Bank', 1810], ['Virgin Money UK plc (Clydesdale Bank, Virgin Money, Yorkshire Bank)', 2015]]
Creating and appending a new list to extract just the dates
bank_dates = []
index1 = 0
for row in data:
# append new date
bank_dates.append(row[1])
index1 +=1
print(bank_dates)
[2013, 1783, 1690, 1865, 1824, 2009, 2010, 2015, 1968, 2010, 2014, 2015, 1872, 1810, 2015]
Creating and appending a new list to extract just the bank names
bank_names = []
index1 = 0
for row in data:
# append new date
bank_names.append(row[0])
index1 +=1
print(bank_names)
['Atom Bank', 'Bank of Ireland UK', 'Barclays', 'HSBC UK', 'Danske Bank UK', 'Lloyds Banking Group†[a]', 'Metro Bank', 'Monzo', 'NatWest Group††[b]', 'Santander Bank', 'Starling Bank', 'Tandem Bank', 'The Cooperative Bank', 'TSB Bank', 'Virgin Money UK plc (Clydesdale Bank, Virgin Money, Yorkshire Bank)']
Functions that returns the total amount of banks and the earliest and latest date founded
def Length(lst):
return len(lst)
length = Length(bank_names)
print(length)
15
def Min(lst):
return min(lst)
Earliest_founded = Min(bank_dates)
print(Earliest_founded)
1690
def Average(lst):
return max(lst)
average = Average(bank_dates)
print(average)
2015
From my findings, there are 15 British retail banks. The earliest was founded in 1690 (Barclays) and the latest in 2015 (Yorkshire Bank)