Day 93 Of 100DaysOfCode: Bank Data Scrapping
Tags: wecoded, 100daysofcode, codenewbie, womenintech
Published: 2021-04-01 16:02:53

This is my 93rd day of #100daysofcode and #python learning journey. For the first project I keep collecting data for this I run my news scrapping code once a day I plan to collect more than 5000 data. I will continue collecting data till 2 weeks from today after that I will do some visualization similarly I also plan to apply some concept of natural language processing to classify news. My first project is not still completed. 
Today I also make a plan to scrapped bank data. My aim here is I collect the interest rate of the maximum bank of Nepal and will do some visualization. I still making  a plan for it. After I plan will complete I  share my whole plan here. Below is my code for the bank's interest rate scrapping using `BeautifulSoup` and  I made `DataFrame` using pandas.

# Bank's Interest rate scrapping code:
Here I import all necessary dependencies.
```python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import re
from bs4 import BeautifulSoup as BS
import requests
import urllib3


urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
```
Url of particular bank which contain interest rates.
```python
url = "https://www.muktinathbank.com.np/interest-rates"
```
```python
http = urllib3.PoolManager()
http.addheaders = [('User-agent', 'Mozilla/61.0')]
web_page = http.request('GET', url)
soup = BS(web_page.data, 'html5lib')
```

```python
muktinath_intrst = []
table = soup.find("table")
for table in soup.findAll("table"):
  df = pd.read_html(str(table))[0]
  muktinath_intrst.append(df)
```
```python
muktinath_intrst[0]
```
Output of above code is,
```python
PRODUCT INFO	PRODUCT	INTEREST RATE(PER ANNUM)	PAYMENT ON	MINIMUM BALANCE
0	{{normal-saving-account}}-{{3.50;3.50;NRs. 500...	1. Normal Saving	3.50%	Quarterly Basis	Rs. 500
1	{{muktinath-premium-bachat}}-{{3.5;3.5;NRs. 10...	2. Muktinath Premium Bachat	3.50%	Quarterly Basis	Rs. 1000
2	NaN	3.Muktinath Special Premium Bachat	3.50%	Quarterly Basis	Rs. 2000
3	{{muktinath-super-premium-saving-account}}-{{5...	4. Muktinath Super Premium Bachat	5.50%	Quarterly Basis	Rs. 5000
4	NaN	5.Current Account	-	-	Rs. 5000
5	NaN	6.Current Account Other *	-	-	Rs. 1000
6	{{mahila-pewa-bachat-khata}}-{{4.5;4.5;Nrs. 50...	7.Mahila Pewa Bachat	4.50%	Quarterly Basis	Rs. 500
7	{{sunaulo-bal-bachat}}-{{3.5;3.5;Nrs. 0;Quater...	8.Sunaulo Bal Shichha Bachat	3.50%	Quarterly Basis	-
8	NaN	9. Baidesik Rojgar Bachat	3.50%	Quarterly Basis	Rs. 500
9	NaN	10. Micro Personal Saving	3.50%	Quarterly Basis	Rs. 100
10	NaN	11. Other Micro Savings	3.50%	Quarterly Basis	Rs. 100
11	{{karmachari-bachat}}-{{3.0;3.0;Nrs. 100;Quate...	12. Karmachari Bachat	3.50%	Quarterly Basis	-
12	{{sharedhani-bachat-khata}}-{{3.0;3.0;Nrs. 100...	13. Sharedhani Bachat Khata	3.50%	Quarterly Basis	Rs. 100
13	NaN	14. Beema Bachat	3.50%	Quarterly Basis	Rs. 100
14	NaN	15. Provident Fund Account	3.50%	Quarterly Basis	-
15	NaN	16. Samajik Surakchha Bhatta Khata	3.50%	Quarterly Basis	-
16	NaN	17. Aatmanirbhar Bachat Khata	5.50%	Quarterly Basis	-
17	{{sajilo-bachat-khata}}-{{3.5;3.5;Nrs. 0;Quate...	18. Sajilo Bachat	3.50%	Quarterly Basis	-
18	{{mero-pahilo-bachat-khata}}-{{3.5;3.5;Nrs. 0;...	19. Mero Pahilo Bachat Khata	3.50%	Quarterly Basis	-
19	NaN	20. Muktinath PMS Khata	3.50%	Quarterly Basis	-
20	NaN	21. Muktinath Jeevan Bardan Bachat Khata	4.00%	Monthly Basis	Rs.5000
21	NaN	22.Muktinath Jeevan Bardan Plus Bachat Khata	4.00%	Monthly Basis	Rs.5000
22	NaN	23.Muktinath Jeevan Bardan Premium Bachat Khata	4.00%	Monthly Basis	Rs.5000
23	NaN	24. Byaktigat Upalabdhi Khata	3.50%	Quarterly Basis	NaN
24	NaN	25.Sansthagat Upalabdhi Khata	up to 1.75%	Quarterly Basis	NaN
25	NaN	26. FCY Deposit ($,£,€,AUD)	up to 1.50%	Quarterly Basis	10
26	NaN	27.Call Depost Account	up to 1.75%	Quarterly Basis	NaN
```
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Day 93 Of <a href="https://twitter.com/hashtag/100daysofcode?src=hash&amp;ref_src=twsrc%5Etfw">#100daysofcode</a> and <a href="https://twitter.com/hashtag/python?src=hash&amp;ref_src=twsrc%5Etfw">#python</a> <br>Scrapping bank data like interest rate from bank website.<a href="https://twitter.com/hashtag/WomenWhoCode?src=hash&amp;ref_src=twsrc%5Etfw">#WomenWhoCode</a> <a href="https://twitter.com/hashtag/CodeNewbie?src=hash&amp;ref_src=twsrc%5Etfw">#CodeNewbie</a> <a href="https://twitter.com/hashtag/100DaysOfCode?src=hash&amp;ref_src=twsrc%5Etfw">#100DaysOfCode</a> <a href="https://twitter.com/hashtag/DEVCommunity?src=hash&amp;ref_src=twsrc%5Etfw">#DEVCommunity</a> <a href="https://t.co/Lq897wtDbJ">pic.twitter.com/Lq897wtDbJ</a></p>&mdash; Durga Pokharel (@durgacodes) <a href="https://twitter.com/durgacodes/status/1377644385450401794?ref_src=twsrc%5Etfw">April 1, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>