edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

[DATA] sign change with to_dataframe() command

Open miruddfan opened this issue 11 months ago • 2 comments

Data Quality Issue Details

Issue Type:

  • [x ] Incorrect financial values (wrong numbers)
  • [ ] Missing financial data (expected data not present)
  • [ x] Calculation errors (formulas producing wrong results)
  • [ ] Data inconsistency (different values for same metric)
  • [ ] Historical data problems (changes over time)

Environment

EdgarTools Version: 5.6.1 Python Version: 3.10.19 Operating System: Win 11

Financial Data Details

IESC: Form Type: 10-k Filing Date/Period: 2024 Statement Type: Income Statement

Specific Metric/Concept:

  • Financial line item: Other (income) expense, net
  • XBRL concept name: ?

Data Issue

Expected Value: No sign change when using income_statement.to_dataframe()

  • Amount: (5,128)
  • Source: IESC 2024 Annual report https://investors.ies-corporate.com/node/18351/html#i0b1ea4dfa8d74694a7005d2566124a07_70
  • Page/section reference: Page 44of 10-K filing

Actual Value from EdgarTools:

  • Amount: 5,128
  • How obtained: (code snippet showing how you retrieved this value)

Code to reproduce:

from edgar import Company

company = Company("iesc")
financials = company.get_financials()
income_statement = financials.income_statement()
is_df = income_statement.to_dataframe()

print(income_statement)
print(is_df)

Cross-Verification

Have you verified this issue with:

  • [ x] Multiple time periods for same company
  • [ ] Multiple companies with same issue
  • [ ] Direct SEC filing comparison
  • [ ] Other financial data sources

Affects multiple periods/companies?

  • This may impact multiple companies. I am not sure if the sign change is intended or not, because the line might be positive or negative and how other math handles the value recorded depends on your sign handling assumptions. Do you have those assumptions documented? Are they consistent?

  • To be more clear. The sign changes from income_statement to income_statement.to_dataframe() in code above. Maybe that is intentional. My code depends on the assumptions you use for this conversion.

Expected Behavior

What should happen: My expectation is that both income_statement and is_df values to be identical (sign and value)

Data validation rules:

  • Should the value be positive/negative?
  • Expected magnitude/range?
  • Should it match specific calculations?

Additional Context

  • Links to official SEC filings showing correct values
  • Screenshots comparing EdgarTools output vs official data
  • Any patterns or hypotheses about why the data might be wrong
  • Related issues or similar problems you've noticed

Impact Assessment:

  • [ ] Minor (affects specific edge case)
  • [ ] Moderate (affects common use cases)
  • [x ] Major (affects core financial calculations)
  • [ ] Critical (produces completely wrong results)

Data quality issues are high priority and will be verified against official SEC filings. Accuracy is fundamental to EdgarTools.

miruddfan avatar Dec 27 '25 14:12 miruddfan

Investigation Complete

Thank you for reporting this issue @miruddfan. After investigation, we found two issues:

1. Bug Fixed: presentation=True wasn't working

There was a bug in _apply_presentation() where columns containing None values (from header/abstract rows) have object dtype, causing the transformation to be silently skipped.

Fix committed: The method now uses pd.to_numeric() to handle mixed-type columns before applying the preferred_sign transformation.

2. Design Clarification: Raw vs Presentation Values

By design (from Issue #463), to_dataframe() returns raw XBRL instance values by default:

Method Returns
print(income_statement) Presentation values (signs transformed)
to_dataframe() Raw XBRL values + metadata columns
to_dataframe(presentation=True) Presentation values (matches display)

To get values matching the display:

df = income_statement.to_dataframe(presentation=True)

The default behavior preserves raw XBRL data integrity, with metadata columns (balance, weight, preferred_sign) for users who need to apply custom transformations.

Your Code Updated

from edgar import Company

company = Company("iesc")
financials = company.get_financials()
income_statement = financials.income_statement()

# Use presentation=True to match the display
is_df = income_statement.to_dataframe(presentation=True)

print(income_statement)  # Shows -5,128 (negative)
print(is_df)             # Now also shows -5,128,000 (negative) ✓

This will be included in the next release.

🤖 Generated with Claude Code

dgunning avatar Dec 27 '25 18:12 dgunning

Fixed in commit 5f404f3d. Will be included in the next release.

dgunning avatar Dec 27 '25 18:12 dgunning