How to get SEC XBRL company financials into pandas
Short answer
US public companies file financial statements in XBRL with the SEC. The Figurewell dataset extracts them: "key_metrics" has common values per company and period, "facts" the full tagged values and "filings" the filing list. Load key_metrics and pivot by period.
- pip install datasets
- Load "key_metrics" for revenue, net income and similar.
- Use "facts" for any other XBRL tag.
- Join "filings" for accession numbers and dates.
Copy-paste code
Data: CyberMax dataset on Hugging Face; load it with the datasets library (pip install datasets)
from datasets import load_dataset
ds = load_dataset("CyberMax-tools/figurewell-sec-xbrl-financials", "key_metrics", split="train")
df = ds.to_pandas()
print(len(df), "rows")
print(df.head())Good to know
Public SEC data; not investment advice.
Figurewell API: SEC financials as they were known, on any date
from $5Need any company back to 2009, point-in-time with EDGAR acceptance times? The Figurewell API: $5 for 1,500 calls.
Secure checkout · 14-day fix-or-refund if it doesn't work as described (terms)Free: the Free API Starter Kit
Copy-paste calls for 4 APIs with free daily tiers (CVE priority, VIN recalls, US duty rates, email checks), then 5 short emails on KEV/EPSS, MCP and free data.