edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

6.2 vs 6.0 incorrect non-numeric data getting into income statement numeric columns

Open mpreiss9 opened this issue 2 weeks ago • 1 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: 6.2 Python Version: 3.15.1
Operating System: macOS

Bug Description

When getting an income statement the usual 2 or 3 dated columns contain the numeric values for the filing. In 6.0 and prior this was always the case.

What actually happened: In 6.2 for some years for some filers erroneous string data is getting into these columns. Sometimes it appears to be the concept name and sometimes a web address.

Error message (if any):

Paste any error messages here

Reproduction

Company/Ticker: ZBH Time Period: Relevant Forms: 10-K

Minimal code to reproduce:

"""
Reproduction: ArrowInvalid in edgartools 6.2 (works in 6.0)

Filing: Zimmer Biomet (ZBH), CIK 1136869, FY 2018 10-K
Error:  ArrowInvalid: Could not convert 'us-gaap:ProductMember'
        with type str: tried to convert to double

Usage:
    pip install edgartools==6.2
    python reproduce.py
"""

import pandas as pd
import polars as pl
from edgar import Company, set_identity

# --- 1. SEC API identity (required by EDGAR) ---
set_identity("Your Name [email protected]")

# --- 2. Locate the ZBH FY2018 10-K ---
company = Company("ZBH")
filings = company.get_filings(form="10-K").latest(10)

for filing in filings:
    print(f"\n=== {filing.form}  period={filing.report_date}  CIK={filing.cik} ===")
    xbrl = filing.xbrl()

    try:
        stmt = xbrl.statements.income_statement()
        df = stmt.to_dataframe(view="standard")
        print(f"  Income Statement:  ({len(df)} rows, {len(df.columns)} cols)")

        # --- Diagnose: find columns with mixed types ---
        for col in df.columns:
            s = df[col].dropna()
            if s.empty:
                continue
            has_str  = s.map(type).eq(str).any()
            has_num  = s.map(type).isin([int, float, pd._libs.missing.NAType]).any()
            if has_str and has_num:
                bad_vals = s[s.map(type).eq(str)].unique().tolist()
                print(f"    MIXED column '{col}': {len(s)} values, "
                      f"strings={bad_vals[:3]}{'...' if len(bad_vals)>3 else ''}")

        # --- Show resulting failure ---
        df_pl = pl.from_pandas(df)
        print(f"  pl.from_pandas OK  ({df_pl.shape})")

    except Exception as e:
        print(f"  FAILED -> {type(e).__name__}: {e}")

Additional Context

6.0 run produces:

=== 10-K  period=2025-12-31  CIK=1136869 ===
  Income Statement:  (24 rows, 19 cols)
  pl.from_pandas OK  ((24, 19))

=== 10-K  period=2024-12-31  CIK=1136869 ===
  Income Statement:  (34 rows, 19 cols)
  pl.from_pandas OK  ((34, 19))

=== 10-K  period=2023-12-31  CIK=1136869 ===
  Income Statement:  (34 rows, 19 cols)
  pl.from_pandas OK  ((34, 19))

=== 10-K  period=2022-12-31  CIK=1136869 ===
  Income Statement:  (34 rows, 19 cols)
  pl.from_pandas OK  ((34, 19))

=== 10-K  period=2021-12-31  CIK=1136869 ===
  Income Statement:  (26 rows, 19 cols)
  pl.from_pandas OK  ((26, 19))

=== 10-K  period=2020-12-31  CIK=1136869 ===
  Income Statement:  (25 rows, 19 cols)
  pl.from_pandas OK  ((25, 19))

=== 10-K  period=2019-12-31  CIK=1136869 ===
  Income Statement:  (25 rows, 19 cols)
  pl.from_pandas OK  ((25, 19))

=== 10-K  period=2018-12-31  CIK=1136869 ===
  Income Statement:  (24 rows, 19 cols)
  pl.from_pandas OK  ((24, 19))

=== 10-K  period=2017-12-31  CIK=1136869 ===
  Income Statement:  (23 rows, 19 cols)
  pl.from_pandas OK  ((23, 19))

=== 10-K  period=2016-12-31  CIK=1136869 ===
  Income Statement:  (23 rows, 19 cols)
  pl.from_pandas OK  ((23, 19))

Process finished with exit code 0

6.2 produces:

=== 10-K  period=2025-12-31  CIK=1136869 ===
  Income Statement:  (24 rows, 19 cols)
    MIXED column '2025-12-31 (FY)': 22 values, strings=['http://fasb.org/us-gaap/2025#ProductMember']
    MIXED column '2024-12-31 (FY)': 22 values, strings=['http://fasb.org/us-gaap/2025#ProductMember']
    MIXED column '2023-12-31 (FY)': 22 values, strings=['http://fasb.org/us-gaap/2025#ProductMember']
  FAILED -> ArrowInvalid: Could not convert 'http://fasb.org/us-gaap/2025#ProductMember' with type str: tried to convert to double

=== 10-K  period=2024-12-31  CIK=1136869 ===
  Income Statement:  (34 rows, 19 cols)
    MIXED column '2024-12-31 (FY)': 28 values, strings=['http://fasb.org/us-gaap/2024#ProductMember']
    MIXED column '2023-12-31 (FY)': 25 values, strings=['http://fasb.org/us-gaap/2024#ProductMember']
    MIXED column '2022-12-31 (FY)': 30 values, strings=['http://fasb.org/us-gaap/2024#ProductMember']
  FAILED -> ArrowInvalid: Could not convert 'http://fasb.org/us-gaap/2024#ProductMember' with type str: tried to convert to double

=== 10-K  period=2023-12-31  CIK=1136869 ===
  Income Statement:  (34 rows, 19 cols)
    MIXED column '2023-12-31 (FY)': 25 values, strings=['http://fasb.org/us-gaap/2023#ProductMember']
    MIXED column '2022-12-31 (FY)': 30 values, strings=['http://fasb.org/us-gaap/2023#ProductMember']
    MIXED column '2021-12-31 (FY)': 31 values, strings=['http://fasb.org/us-gaap/2023#ProductMember']
  FAILED -> ArrowInvalid: Could not convert 'http://fasb.org/us-gaap/2023#ProductMember' with type str: tried to convert to double

=== 10-K  period=2022-12-31  CIK=1136869 ===
  Income Statement:  (34 rows, 19 cols)
    MIXED column '2022-12-31 (FY)': 30 values, strings=['http://fasb.org/us-gaap/2022#ProductMember']
    MIXED column '2021-12-31 (FY)': 31 values, strings=['http://fasb.org/us-gaap/2022#ProductMember']
    MIXED column '2020-12-31 (FY)': 30 values, strings=['http://fasb.org/us-gaap/2022#ProductMember']
  FAILED -> ArrowInvalid: Could not convert 'http://fasb.org/us-gaap/2022#ProductMember' with type str: tried to convert to double

=== 10-K  period=2021-12-31  CIK=1136869 ===
  Income Statement:  (26 rows, 19 cols)
    MIXED column '2021-12-31 (FY)': 25 values, strings=['http://fasb.org/us-gaap/2021-01-31#ProductMember']
    MIXED column '2020-12-31 (FY)': 24 values, strings=['http://fasb.org/us-gaap/2021-01-31#ProductMember']
    MIXED column '2019-12-31 (FY)': 24 values, strings=['http://fasb.org/us-gaap/2021-01-31#ProductMember']
  FAILED -> ArrowInvalid: Could not convert 'http://fasb.org/us-gaap/2021-01-31#ProductMember' with type str: tried to convert to double

=== 10-K  period=2020-12-31  CIK=1136869 ===
  Income Statement:  (25 rows, 19 cols)
    MIXED column '2020-12-31 (FY)': 24 values, strings=['us-gaap:ProductMember']
    MIXED column '2019-12-31 (FY)': 24 values, strings=['us-gaap:ProductMember']
    MIXED column '2018-12-31 (FY)': 24 values, strings=['us-gaap:ProductMember']
  FAILED -> ArrowInvalid: Could not convert 'us-gaap:ProductMember' with type str: tried to convert to double

=== 10-K  period=2019-12-31  CIK=1136869 ===
  Income Statement:  (25 rows, 19 cols)
    MIXED column '2019-12-31 (FY)': 24 values, strings=['us-gaap:ProductMember']
    MIXED column '2018-12-31 (FY)': 24 values, strings=['us-gaap:ProductMember']
    MIXED column '2017-12-31 (FY)': 24 values, strings=['us-gaap:ProductMember']
  FAILED -> ArrowInvalid: Could not convert 'us-gaap:ProductMember' with type str: tried to convert to double

=== 10-K  period=2018-12-31  CIK=1136869 ===
  Income Statement:  (24 rows, 19 cols)
    MIXED column '2018-12-31 (FY)': 23 values, strings=['us-gaap:ProductMember']
    MIXED column '2017-12-31 (FY)': 23 values, strings=['us-gaap:ProductMember']
    MIXED column '2016-12-31 (FY)': 23 values, strings=['us-gaap:ProductMember']
  FAILED -> ArrowInvalid: Could not convert 'us-gaap:ProductMember' with type str: tried to convert to double

=== 10-K  period=2017-12-31  CIK=1136869 ===
  Income Statement:  (23 rows, 19 cols)
  pl.from_pandas OK  ((23, 19))

=== 10-K  period=2016-12-31  CIK=1136869 ===
  Income Statement:  (23 rows, 19 cols)
  pl.from_pandas OK  ((23, 19))

Process finished with exit code 0

Add any other context about the problem here. Screenshots, related issues, etc.


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

mpreiss9 avatar Nov 17 '26 17:11 mpreiss9

Thanks for the clear repro. I can reproduce it on 6.2: Zimmer Biomet tags two "extensible list" facts (type of revenue and type of cost) on the face of its income statement, and their filed value is a member name like us-gaap:ProductMember. 6.0 coerced those cells to NaN; a change in 6.2 meant to keep text in note tables started keeping them in primary statements too. I'll restore numeric value columns for primary statements in 6.2.1. Until then, this gets you back to the 6.0 frame:

date_cols = [c for c in df.columns if c[:4].isdigit()]
df[date_cols] = df[date_cols].apply(pd.to_numeric, errors="coerce")

dgunning avatar Nov 17 '26 18:11 dgunning