Pandas - Data_IO

read_csv()
to_csv()
read_excel()
to_excel()
read_html()
https://www.fdic.gov/bank/individual/failed/banklist.html

import pandas as pd
pwd
'/Users/ram/dev/bhavya/PythonClass/docs/Notebooks'
df = pd.read_csv('../Inputs/example_1')
df
a b c d
0 0 1 2 3
1 4 5 6 7
2 8 9 10 11
3 12 13 14 15
df.to_csv('../Inputs/example_pdsave')
df = pd.read_excel('../Inputs/Excel_Sample.xlsx')
df
Unnamed: 0 a b c d
0 0 0 1 2 3
1 1 4 5 6 7
2 2 8 9 10 11
3 3 12 13 14 15
df.to_excel('../Inputs/Excel_Save.xlsx', index='False')
data = pd.read_html('https://www.fdic.gov/bank/individual/failed/banklist.html')
type(data)
list
data
[                             Bank Name           City  ST   CERT  \
 0                 The First State Bank  Barboursville  WV  14361   
 1                   Ericson State Bank        Ericson  NE  18265   
 2     City National Bank of New Jersey         Newark  NJ  21111   
 3                        Resolute Bank         Maumee  OH  58317   
 4                Louisa Community Bank         Louisa  KY  58112   
 ..                                 ...            ...  ..    ...   
 556                 Superior Bank, FSB       Hinsdale  IL  32646   
 557                Malta National Bank          Malta  OH   6629   
 558    First Alliance Bank & Trust Co.     Manchester  NH  34264   
 559  National State Bank of Metropolis     Metropolis  IL   3815   
 560                   Bank of Honolulu       Honolulu  HI  21029   

                    Acquiring Institution       Closing Date  
 0                         MVB Bank, Inc.      April 3, 2020  
 1             Farmers and Merchants Bank  February 14, 2020  
 2                        Industrial Bank   November 1, 2019  
 3                     Buckeye State Bank   October 25, 2019  
 4      Kentucky Farmers Bank Corporation   October 25, 2019  
 ..                                   ...                ...  
 556                Superior Federal, FSB      July 27, 2001  
 557                    North Valley Bank        May 3, 2001  
 558  Southern New Hampshire Bank & Trust   February 2, 2001  
 559              Banterra Bank of Marion  December 14, 2000  
 560                   Bank of the Orient   October 13, 2000  

 [561 rows x 6 columns]]
data[0]
Bank Name City ST CERT Acquiring Institution Closing Date
0 The First State Bank Barboursville WV 14361 MVB Bank, Inc. April 3, 2020
1 Ericson State Bank Ericson NE 18265 Farmers and Merchants Bank February 14, 2020
2 City National Bank of New Jersey Newark NJ 21111 Industrial Bank November 1, 2019
3 Resolute Bank Maumee OH 58317 Buckeye State Bank October 25, 2019
4 Louisa Community Bank Louisa KY 58112 Kentucky Farmers Bank Corporation October 25, 2019
... ... ... ... ... ... ...
556 Superior Bank, FSB Hinsdale IL 32646 Superior Federal, FSB July 27, 2001
557 Malta National Bank Malta OH 6629 North Valley Bank May 3, 2001
558 First Alliance Bank & Trust Co. Manchester NH 34264 Southern New Hampshire Bank & Trust February 2, 2001
559 National State Bank of Metropolis Metropolis IL 3815 Banterra Bank of Marion December 14, 2000
560 Bank of Honolulu Honolulu HI 21029 Bank of the Orient October 13, 2000

561 rows × 6 columns