Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
71 lines (55 loc) · 2.57 KB

File metadata and controls

71 lines (55 loc) · 2.57 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""Example usage of pandas integration — to_dataframe() on response models."""
from edgar.client import EdgarClient
from edgar.models import to_dataframe
# Initialize the client.
# SEC EDGAR requires a User-Agent in the format "Company/Name email@example.com".
edgar_client = EdgarClient(user_agent="Your Name your-email@example.com")
# ---------------------------------------------------------------------------
# Convert XBRL facts to a DataFrame via Facts.to_dataframe()
# ---------------------------------------------------------------------------
company = edgar_client.company("AAPL")
facts = company.get_facts()
df = facts.to_dataframe("us-gaap", "Revenues", unit="USD")
print("=== Apple Revenue (USD) ===")
print(df[["end", "value", "form", "fiscal_year"]].tail())
# Output:
# end value form fiscal_year
# 2023-09-30 383285000000 10-K 2023
# 2024-09-28 391035000000 10-K 2024
# ---------------------------------------------------------------------------
# Convert any model list using the standalone to_dataframe()
# ---------------------------------------------------------------------------
# Filings
filings = company.get_filings(form="10-K")
df_filings = to_dataframe(filings)
print("\n=== 10-K Filings DataFrame ===")
print(df_filings[["form_type", "filing_date", "accession_number"]].head())
# Output:
# form_type filing_date accession_number
# 10-K 2024-11-01T18:04:51-04:00 0000320193-24-000123
# ---------------------------------------------------------------------------
# Convert search results to a DataFrame
# ---------------------------------------------------------------------------
results = edgar_client.search(
q='"artificial intelligence"',
form_types=["10-K"],
start_date="2024-01-01",
end_date="2024-12-31",
size=10,
)
df_search = to_dataframe(results)
print("\n=== Search Results DataFrame ===")
print(df_search[["company_name", "form", "filing_date"]].head())
# Output:
# company_name form filing_date
# Apple Inc. (AAPL) (CIK 0000320193) 10-K 2024-11-01
# ---------------------------------------------------------------------------
# Convert submissions to a DataFrame
# ---------------------------------------------------------------------------
info = company.get_info()
df_subs = to_dataframe(info.recent_submissions[:10])
print("\n=== Recent Submissions DataFrame ===")
print(df_subs[["form", "filing_date", "accession_number"]].head())
# Output:
# form filing_date accession_number
# 10-K 2024-11-01 0000320193-24-000123
Morty Proxy This is a proxified and sanitized view of the page, visit original site.