Skip to content

Commit

Permalink
Add filiering using query
Browse files Browse the repository at this point in the history
  • Loading branch information
dgunning committed Aug 22, 2024
1 parent 2c06cea commit 9f9aee2
Showing 1 changed file with 62 additions and 9 deletions.
71 changes: 62 additions & 9 deletions notebooks/Extract-Earnings-Releases.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@
"id": "943c2aaf-994e-426e-87e8-8edcf70e2141",
"metadata": {},
"source": [
"Select an exhibit by index"
"## Select an exhibit by index"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 10,
"id": "f70fa521-b80d-44a2-9913-8f179679fc7d",
"metadata": {
"scrolled": true
Expand All @@ -201,20 +201,35 @@
{
"data": {
"text/plain": [
"╭───────────────────┬─────────────┬───────────────╮\n",
"\u001b[1m \u001b[0m\u001b[1mDocument \u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mDescription\u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mType\u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mSize \u001b[0m\u001b[1m \u001b[0m│\n",
"├───────────────────┼─────────────┼───────────────┤\n",
"aapl-20240801.htm │ 8-K │ 8-K │ 40.2 KB │\n",
"╰───────────────────┴─────────────┴───────────────╯"
"╭─────────────────────────────┬─────────────┬─────────┬──────────╮\n",
"\u001b[1m \u001b[0m\u001b[1mDocument \u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mDescription\u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mType \u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mSize \u001b[0m\u001b[1m \u001b[0m│\n",
"├─────────────────────────────┼─────────────┼─────────┼──────────┤\n",
"a8-kex991q3202406292024.htm │ EX-99.1 │ EX-99.1 │ 164.5 KB │\n",
"╰─────────────────────────────┴─────────────┴─────────┴──────────╯"
]
},
"execution_count": 5,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"exhibits[0]"
"exhibits[1]"
]
},
{
"cell_type": "markdown",
"id": "2bca1b22-c010-4b6b-bad1-c7f427dc48de",
"metadata": {},
"source": [
"## Query for just exhibit EX-99.1\n",
"Alternatively, you can use the query function to make sure you are selecting only EX-99.1. Not all filings have this exhibit\n",
"\n",
"```python\n",
"results = exhibits.query(\"document_type in ['EX-99.1', 'EX-99', 'EX-99.01']\")\n",
"if len(results) > 0:\n",
" print(results[0])\n",
"```"
]
},
{
Expand Down Expand Up @@ -415,6 +430,44 @@
"exhibit_text = HtmlDocument.from_html(exhibits[1].download()).text\n",
"print(exhibit_text)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "7e066bd2-8904-44cb-b3f7-db91a95b2e51",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
],
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮\n",
"\u001b[3m Documents \u001b[0m │\n",
"│ │\n",
"\u001b[1m \u001b[0m\u001b[1mSeq\u001b[0m\u001b[1m \u001b[0m \u001b[1m \u001b[0m\u001b[1mDocument \u001b[0m\u001b[1m \u001b[0m \u001b[1m \u001b[0m\u001b[1mDescription\u001b[0m\u001b[1m \u001b[0m \u001b[1m \u001b[0m\u001b[1mType \u001b[0m\u001b[1m \u001b[0m \u001b[1m \u001b[0m\u001b[1mSize \u001b[0m\u001b[1m \u001b[0m │\n",
"│ ────────────────────────────────────────────────────────────────────── │\n",
"│ 2 a8-kex991q3202406292024.htm EX-99.1 EX-99.1 164.5 KB │\n",
"│ │\n",
"╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"exhibits.query(\"document_type in ['EX-99.1', 'EX-99', 'EX-99.01']\")"
]
}
],
"metadata": {
Expand Down

0 comments on commit 9f9aee2

Please sign in to comment.