Python read XRBL Bank Call Report

104 Views Asked by At

I am trying to parse the XRBL download for a bank call report from https://cdr.ffiec.gov/public/ManageFacsimiles.aspx to analyse the data in python. I cannot figure out how to convert the data to an array, dataframe, dict, json, or a list to use the data for financial analysis.

import xbrl
import bs4 as bs
from xbrl import XBRLParser, GAAP, GAAPSerializer


xbrl_file = "Call_Cert57944_063023.XBRL"


xbrl_parser = XBRLParser()
xbrl_document = xbrl_parser.parse(xbrl_file)
print(xbrl_document)

<cc:rcons550 contextref="CI_3357219_2023-06-30" decimals="0" unitref="USD">0</cc:rcons550>
<cc:rcon6835 contextref="CI_3357219_2023-06-30" decimals="0" unitref="USD">1577000</cc:rcon6835>
<cc:rcons556 contextref="CI_3357219_2023-06-30" decimals="0" unitref="USD">0</cc:rcons556>
<cc:rcons555 contextref="CI_3357219_2023-06-30" decimals="0" unitref="USD">0</cc:rcons555>


bank_call = xbrl_document.prettify()
print(bank_call)

    0
   </cc:rcons490>
   <cc:rcons491 contextref="CI_3357219_2023-06-30" decimals="0" unitref="USD">
    0
   </cc:rcons491>
   <cc:rcons496 contextref="CI_3357219_2023-06-30" decimals="0" unitref="USD">
    0
   </cc:rcons496>


custom_obj = xbrl_parser.parseCustom(xbrl_document)

# sample output below
print(custom_obj())

dict_items([('rcona573', '321334000'), ('riad4356', '0'), ('rcona571', '52305000'), 
('rcona570', '476535000'), ('rcons498', '0'), ('rcona575', '0'), ('rcona574', '35287000'), 
('rcon5370', '20000'), ('rcons452', '0'), ('rcons453', '0'), ('rcons450', '0'),
0

There are 0 best solutions below