edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

get_statement method not showing up on Company object

Open MonopolisticInvestor opened this issue 1 year ago • 3 comments

Issue Type

  • [ ] Data Quality Issue (incorrect financial values, missing data)
  • [ ] XBRL Parsing Issue (statement rendering, concept mapping)
  • [X] Filing Access Issue (download failures, attachment problems)
  • [ ] Performance Issue (slow operations, memory problems)
  • [ ] Compatibility Issue (platform/dependency conflicts)
  • [ ] Documentation Issue (unclear instructions, missing examples)

Environment

EdgarTools Version: Version: 4.23.0 Python Version: Python 3.11.2 Operating System: Linux Debian

Bug Description

What you expected to happen: I expected to see a segment filing, as defined here: https://edgartools.readthedocs.io/en/latest/StatementType-Quick-Reference/?h=segment#analytical-statements

What actually happened: The program said that the method isn't defined. How is that possible - for AAPL? Other companies also don't work

Error message (if any):

 segment = company.get_statement(StatementType.SEGMENTS)
              ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Company' object has no attribute 'get_statement'

Reproduction

Company/Ticker: (e.g., AAPL) Time Period: (e.g., 2020-2023, Q4 2023) Relevant Forms:

Minimal code to reproduce:

# Paste the minimal code that reproduces the issue
from edgar import Company, set_identity
from edgar.enums import StatementType

set_identity("your name your email")
company = Company("AAPL")
segment = company.get_statement(StatementType.SEGMENTS)
print(segment)

Additional Context

https://edgartools.readthedocs.io/en/latest/StatementType-Quick-Reference/?h=segment#analytical-statements I used documentation from here - any ideas why it doesn't work?


This issue will be handled using EdgarTools' systematic issue resolution workflow. A reproduction test will be created to verify the fix.

MonopolisticInvestor avatar Nov 28 '25 07:11 MonopolisticInvestor

Documentation Error - Correct API for Accessing Segment Statements

Hi @MonopolisticInvestor,

Thank you for reporting this! You've uncovered a documentation bug in our official documentation. The Company.get_statement() method shown in the docs does not exist - this API is only available on XBRL objects, not Company objects.

What Happened

The documentation at readthedocs incorrectly shows:

company = Company("AAPL")
segment = company.get_statement(StatementType.SEGMENTS)  # ❌ This doesn't work

This is a documentation error from when we added the StatementType enum. The get_statement() method exists on XBRL objects, not Company objects.

Correct Way to Access Segment Statements

Here are the correct approaches:

Option 1: Via XBRL Object (Most Direct)

from edgar import Company

company = Company("AAPL")
filing = company.get_filings(form="10-K").latest()
xbrl = filing.xbrl()

# Get segment statement data
segment_data = xbrl.get_statement("segment_reporting")
print(segment_data)

Option 2: Via Income Statement (Automatic)

from edgar import Company

company = Company("AAPL")
filing = company.get_filings(form="10-K").latest()
xbrl = filing.xbrl()

# Segment data appears automatically in dimensional display
income = xbrl.statements.income_statement()
# Shows segment breakdowns by product, geography, etc.
print(income)

Next Steps

We've added this to our v4.34.0 roadmap to fix the documentation:

  • ✅ Tracked: Beads issue edgartools-sk8
  • ✅ Prioritized: P1 (High) - documentation accuracy critical for beginners
  • ✅ Estimated: 1-2 hours to update docs with correct examples
  • ✅ Target: v4.34.0 release (week of Dec 2)

We'll update the StatementType Quick Reference with the correct API and add comprehensive examples for accessing segment statements.

Additional Context

Segment data is actually well-supported in EdgarTools - it appears automatically in income statements when companies report dimensional data (by business segment, geography, product line, etc.). The only issue was the incorrect documentation showing the wrong API.

Also note that you're on version 4.23.0, and the current version is 4.33.0. While upgrading won't fix this particular documentation issue (the method never existed), you'll get many other bug fixes and improvements.

Thank you for helping us improve EdgarTools! Documentation accuracy is critical for our "beginner-friendly" mission.

dgunning avatar Nov 28 '25 14:11 dgunning

Fix Implemented

The documentation has been corrected. The changes are:

StatementType-Quick-Reference.md

  • Completely rewrote the documentation to show the correct APIs
  • Added clear section explaining the two ways to access financial statements:
    1. Company API: company.income_statement(), company.balance_sheet(), company.cash_flow() - for multi-period historical data
    2. XBRL API: xbrl.get_statement(StatementType.XXX) - for full statement access including segments
  • Added dedicated section for accessing segment statements via XBRL
  • Added API comparison table showing which API to use for which use case

Key Clarification

  • Company.get_statement() does NOT exist and never did
  • Company has individual methods: income_statement(), balance_sheet(), cash_flow()
  • XBRL has get_statement() method that accepts StatementType enum
  • Segment data is only available through XBRL API

The fix will be included in the next release. In the meantime, use:

from edgar import Company
from edgar.enums import StatementType

company = Company("AAPL")
filing = company.get_filings(form="10-K").latest()
xbrl = filing.xbrl()

# Get segment data via XBRL
segment_data = xbrl.get_statement(StatementType.SEGMENTS)

Thank you again for reporting this!

dgunning avatar Nov 28 '25 14:11 dgunning

Fixed in commit 6667ff91. Documentation corrected to show proper APIs for accessing financial statements. Will be included in v4.33.1.

dgunning avatar Nov 28 '25 15:11 dgunning