edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

income_statement.to_dataframe does not translate EPS through shares from income_statement

Open miruddfan opened this issue 11 months ago • 3 comments

Issue Type

  • [x ] Data Quality Issue (incorrect financial values, missing data)
  • [ x] XBRL Parsing Issue (statement rendering, concept mapping)
  • [ ] 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:5.7.1 Python Version:3.10.19
Operating System:win 11

Bug Description

What you expected to happen: Using the command income_statement.to_dataframe() would translate the information from the income statement

What actually happened: Blank values for EPS and beyond on income statement

Error message (if any):

None

Reproduction

Company/Ticker:V Time Period:2025 Relevant Forms:10k Income Statement

Minimal code to reproduce:

# Paste the minimal code that reproduces the issue
from edgar import Company
company_ticker = "V"  # Example: Apple Inc.
company = Company(company_ticker)
financials = company.get_financials()
income_statement = financials.income_statement()
#is_df = income_statement.to_dataframe(include_dimensions=False,presentation=True)
#is_df = income_statement.to_dataframe(presentation=True)
is_df = income_statement.to_dataframe()
print(income_statement) 
print(is_df)

Additional Context

all three versions of the is_df code above reproduced the same error.


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

miruddfan avatar Jan 02 '26 20:01 miruddfan

Thank you for reporting this, @miruddfan! I've investigated this issue thoroughly.

Summary

This is actually expected behavior for companies with multiple share classes, but I completely understand why it's confusing. Let me explain what's happening.

What You're Seeing

Visa has 4 classes of stock (A, B-1, B-2, C), each with different conversion ratios and voting rights. Under US GAAP accounting rules, companies with multiple share classes must report separate EPS for each class.

In your dataframe:

  • Row 35: "Basic earnings per share" shows NaN (this is a header/abstract row)
  • Rows 36-39: Show the actual EPS for each class:
    • Class A: $10.22
    • Class B-1: $15.97
    • Class B-2: $15.72
    • Class C: $40.87

The data is NOT missing - it's just broken down by share class instead of showing a single value.

Why Abstract Rows Have NaN

Header rows (called "abstract" rows in XBRL terminology) are organizational elements that group related line items. They don't have values themselves - they're like section headers in the statement. The actual data is in the child rows below them.

This is similar to how "Current Assets" is a header with no value, while "Cash", "Accounts Receivable", etc. have actual values.

Other Multi-Class Stock Companies

This same pattern appears for other multi-class stocks:

  • Alphabet (GOOG/GOOGL) - Class A, B, C shares
  • Berkshire Hathaway (BRK.A/BRK.B) - Class A, B shares
  • Meta (META) - Class A, B shares

What We're Improving

You're absolutely right that this is confusing! I've created a UX enhancement for v5.8.0:

Beads Issue: edgartools-03zg
Priority: P2 (Medium)
Target Release: v5.8.0

Planned improvements:

  1. Hide abstract rows without data - Remove confusing "NaN" header rows when all data is dimensional
  2. Add documentation - Explain multi-class stock handling with examples
  3. Consider metadata - Add indicators showing when dimensional breakdowns are present

Workaround for Now

To see the data clearly:

# The default view includes all class-specific data
df = income_statement.to_dataframe()

# Filter to just see data rows (exclude abstracts with NaN)
data_only = df[df['abstract'] == False]

# Or look at a specific share class
class_a_data = df[df['dimension_label'].str.contains('Class A', na=False)]

Thank you for your systematic testing - your Issues #575 (critical bug!) and #576 (UX improvement) are helping us improve EdgarTools for everyone!


Classification: UX Enhancement (not a bug - data is correct but presentation could be clearer)
Tracking: edgartools-03zg

dgunning avatar Jan 02 '26 20:01 dgunning

Thanks - I will look at this. The unstructured (or - loosely structured) EDGAR information is painful.

miruddfan avatar Jan 02 '26 20:01 miruddfan

Resolution

Good news! After investigation, the EPS data is now showing correctly in the latest version. The class-specific EPS values are all present in the dataframe:

Basic EPS:
  Class A: $10.22
  Class B-1: $15.97
  Class B-2: $15.72
  Class C: $40.87

Diluted EPS:
  Class A: $10.20
  Class B-1: $15.95
  Class B-2: $15.70
  Class C: $40.82

What was fixed

The issue was related to XBRL structural element filtering that has since been improved (edgartools-03zg in v5.7.3+).

Remaining UX Polish

You may still see abstract header rows (like 'Basic earnings per share') showing NaN with the actual values in child rows below. This is technically correct but can be confusing. We've created a follow-up issue to improve this UX:

Bead: edgartools-wjz3 - Hide abstract headers when all children are dimensional

Workaround

To filter out abstract rows:

df = income_statement.to_dataframe()
df_clean = df[df['abstract'] == False]

Closing this issue as the core data problem is resolved. Thank you for the detailed report!

dgunning avatar Jan 04 '26 14:01 dgunning