edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

AttributeError: 'EntityFilings' object has no attribute 'statements'

Open rpayanm opened this issue 1 year ago • 8 comments

I have this code:

from edgar import *

company = Company('AAPL')
filings = company.get_filings(form="10-K").latest(9)
financials = MultiFinancials(filings)

balance_sheet = financials.balance_sheet()

I got this error:

File "/Users/user/PythonProject/example/.venv/lib/python3.9/site-packages/edgar/financials.py", line 77, in balance_sheet
    return self.xbs.statements.balance_sheet()
AttributeError: 'EntityFilings' object has no attribute 'statements'

Do you know what I am doing wrong?

Thank you in advance!

rpayanm avatar May 28 '25 01:05 rpayanm

Battling with this as well.

Great if we could get an update.

By the docs: 
 company = Company("AAPL") // Works
    filings = company.latest("10-K", 5) // Works
    financials = MultiFinancials(filings) // Returns None because AttributeError: 'EntityFilings' object has no attribute 'statements'

Using financials = MultiFinancials.extract(filings) at least returns a

Danfraga33 avatar May 28 '25 01:05 Danfraga33

Solved it.

def get_financials(ticker):
    company = Company(ticker)
    filings = company.latest("10-K", 5)
    financials = MultiFinancials.extract(filings)
    income_statement = financials.income_statement()
    return repr(income_statement)  

Remember to return repr( )

--

Will send a PR

Danfraga33 avatar May 28 '25 01:05 Danfraga33

Hi @Danfraga33 , wonder if you konw why I am getting this error: AttributeError: 'EntityData' object has no attribute 'latest'

soloist96 avatar May 28 '25 06:05 soloist96

I'm checking. Will update tomorrow

dgunning avatar May 29 '25 02:05 dgunning

MultiFinancials.extract(filings) is the correct way instead of MultiFinancials(filings)

With the rewrite of XBRL we added XBRLS as the top level object for the multiple financials so the call was XBRLS(filings). For legacy reasons. we retained MultiFinancials and inside of it we used xbs = XBRLS.from_filings(xbs).

So there are 2 ways to do this which isn't ideal. I will improve the documentation and then on the weekend think about how to streamline the API

dgunning avatar May 29 '25 11:05 dgunning

Thank you, @dgunning MultiFinancials.extract(filings) works, but I got no data on Revenue for the last 10-K for AAPL:

company = Company('AAPL')

filings = company.get_filings(form="10-K").latest(9)
financials = MultiFinancials.extract(filings)

balance_sheet = financials.balance_sheet().to_dataframe()
income_statement = financials.income_statement().to_dataframe()
cash_flow = financials.cashflow_statement().to_dataframe()

print(financials.income_statement().render('html'))

Image

rpayanm avatar May 29 '25 13:05 rpayanm

Checking ... will let you know later

dgunning avatar Jun 04 '25 13:06 dgunning

This is fixed in the latest release

Image

dgunning avatar Jul 06 '25 16:07 dgunning