to_dataframe(view='standard') deprecation warning from statements.py:1044
Issue Type
- [ ] 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.8.3 (e.g., 4.9.0)
Python Version:3.10.19 (e.g., 3.10.5)
Operating System:win10 (e.g., macOS 14.0, Windows 11, Ubuntu 22.04)
Bug Description
What you expected to happen: No error message
What actually happened: deprecation message
Error message (if any):
statements.py:1044: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '[ 0. 0. 0. -0. 0. -0. -0. -0. -0. 0. 0. 0. 0. 0. 0. 0. 0. -0.
0. -0. -0. 0. 0. -0. -0. -0. 0. 0. -0. 0. 0. 0. 0. 0.]' has dtype incompatible with bool, please explicitly cast to a compatible dtype first.
result.loc[mask, col] = numeric_col[mask] * result.loc[mask, 'preferred_sign']
Reproduction
Company/Ticker:MSFT Time Period:2024 (e.g., 2020-2023, Q4 2023) Relevant Forms:cash_flow and Income statement, but not balance sheet (e.g., 10-K, 10-Q, 8-K)
Minimal code to reproduce:
# Paste the minimal code that reproduces the issue
from edgar import Company
company = Company("MSFT")
company_ticker = input("Enter company ticker (e.g., MSFT): ").upper()
company = Company(company_ticker)
financials = company.get_financials()
balance_sheet = financials.balance_sheet()
income_statement = financials.income_statement()
cash_flow = financials.cashflow_statement()
bs_df = balance_sheet.to_dataframe(presentation=True)
is_df = income_statement.to_dataframe(presentation=True)
cf_df = cash_flow.to_dataframe(presentation=True)
Additional Context
I tested .to_dataframe() ; .to_dataframe(view='standard'), to_dataframe(presentation=True) and to_dataframe(view='standard, presentation=True) - the error only shows up with presentation = Ture for income and cash flow.
The message shows up for multiple companies.
This issue will be handled using EdgarTools' systematic issue resolution workflow. A reproduction test will be created to verify the fix.
Issue Classification
Thanks for the detailed report @miruddfan! I've triaged this issue.
Classification: Normal Bug (Forward Compatibility) Priority: P1 (HIGH) Target Release: v5.10.0 (next minor release)
Analysis
You're seeing a pandas FutureWarning because of a dtype incompatibility in our presentation transformation logic (statements.py:1138). The good news:
✅ Your data is correct - The warning doesn't affect the values ✅ No workaround needed - You can safely ignore the warning for now ⚠️ Future risk - This will break in future pandas versions
Root Cause
When presentation=True is used with Income/Cash Flow statements, we multiply values by preferred_sign to match SEC HTML display. The code assigns float values to object-dtype columns without explicit casting, which pandas now warns about.
Balance sheets don't show this warning because we intentionally skip the transformation for them (line 1140).
Fix Plan
Estimated Effort: XS (0.2 days - ~2 hours)
Approach: Add explicit dtype conversion before assignment at line 1138:
# Before assignment, ensure column is numeric dtype
result[col] = result[col].astype('float64', errors='ignore')
result.loc[mask, col] = numeric_col[mask] * result.loc[mask, 'preferred_sign']
Test Requirements: We'll add a regression test that:
- Reproduces the warning with MSFT 2024 data
- Verifies the fix eliminates the warning
- Confirms data accuracy is maintained
- Tests both Income Statement and Cash Flow Statement
Timeline
This will be fixed in v5.10.0 (next minor release), scheduled within the next week. Not doing a point release because:
- Data is accurate (no data accuracy issue)
- Functionality works (no blocking issue)
- Forward compatibility fix (proactive improvement)
Thanks for the thorough reproduction case! This helps us maintain EdgarTools quality.
Tracked in Beads: edgartools-kp49 | Target: v5.10.0