Skip to content

Commit

Permalink
Update for 08-17-2024
Browse files Browse the repository at this point in the history
  • Loading branch information
fja05680 committed Aug 17, 2024
1 parent b5b5ef9 commit 545a1a9
Show file tree
Hide file tree
Showing 8 changed files with 1,403 additions and 1,382 deletions.
108 changes: 54 additions & 54 deletions PIT to Ticker Delta.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"id": "f9ee0bdb-b288-478d-9deb-bd157cfaf8f3",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -70,7 +70,7 @@
"4 1996-01-11 AAL,AAMRQ,AAPL,ABI,ABS,ABT,ABX,ACKH,ACV,ADM,AD..."
]
},
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -80,14 +80,14 @@
"from tqdm import tqdm\n",
"import json\n",
"\n",
"df = pd.read_csv(\"S&P 500 Historical Components & Changes(04-08-2024).csv\")\n",
"df = pd.read_csv(\"S&P 500 Historical Components & Changes(08-17-2024).csv\")\n",
"df['date'] = pd.to_datetime(df['date'])\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "b1423720-3384-4d61-ae24-bca401d157d6",
"metadata": {},
"outputs": [],
Expand All @@ -102,15 +102,15 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "e6f3434e-7c64-48e8-8169-c6950f9dacaf",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████████████████████████████████████████████████████████████████████████| 1163/1163 [03:26<00:00, 5.63it/s]\n"
"100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1168/1168 [05:19<00:00, 3.66it/s]\n"
]
}
],
Expand All @@ -136,7 +136,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "27c4ed4d-f8a1-4b05-a785-bf1e4090317e",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -169,32 +169,32 @@
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>THC</td>\n",
" <td>1996-01-02</td>\n",
" <td>2016-04-18</td>\n",
" <td>A</td>\n",
" <td>2000-06-05</td>\n",
" <td>NaT</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>TEX</td>\n",
" <td>2006-12-20</td>\n",
" <td>2008-11-06</td>\n",
" <td>FRC</td>\n",
" <td>2019-01-02</td>\n",
" <td>2023-05-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>RRC</td>\n",
" <td>2007-12-21</td>\n",
" <td>2018-06-18</td>\n",
" <td>FBF</td>\n",
" <td>1996-01-02</td>\n",
" <td>2004-04-01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>WB</td>\n",
" <td>1996-01-02</td>\n",
" <td>2009-01-02</td>\n",
" <td>CMCSK</td>\n",
" <td>2015-09-21</td>\n",
" <td>2015-12-14</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>PRU</td>\n",
" <td>2002-07-22</td>\n",
" <td>PCAR</td>\n",
" <td>1996-01-02</td>\n",
" <td>NaT</td>\n",
" </tr>\n",
" </tbody>\n",
Expand All @@ -203,14 +203,14 @@
],
"text/plain": [
" ticker start_date end_date\n",
"0 THC 1996-01-02 2016-04-18\n",
"1 TEX 2006-12-20 2008-11-06\n",
"2 RRC 2007-12-21 2018-06-18\n",
"3 WB 1996-01-02 2009-01-02\n",
"4 PRU 2002-07-22 NaT"
"0 A 2000-06-05 NaT\n",
"1 FRC 2019-01-02 2023-05-04\n",
"2 FBF 1996-01-02 2004-04-01\n",
"3 CMCSK 2015-09-21 2015-12-14\n",
"4 PCAR 1996-01-02 NaT"
]
},
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -223,39 +223,39 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "f4aed634-93c0-4c36-8907-3cdcd53af73c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ticker\n",
"COV 3\n",
"MEE 2\n",
"HP 2\n",
"H 2\n",
"HCA 2\n",
"MIR 2\n",
"ESV 2\n",
"HLT 2\n",
"EQT 2\n",
"PCG 2\n",
"OI 2\n",
"CNC 2\n",
"HRS 2\n",
"AN 2\n",
"AMP 2\n",
"COV 3\n",
"MEE 2\n",
"DOW 2\n",
"GGP 2\n",
"MXIM 2\n",
"IR 2\n",
"CBE 2\n",
"FL 2\n",
"DXC 2\n",
"CCI 2\n",
"TT 2\n",
"AMD 2\n",
"AMP 2\n",
"CE 2\n",
"CEG 2\n",
"Name: start_date, dtype: int64"
]
},
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Look at top tickers entereing and leaving S&P 500\n",
"# Look at top tickers entering and leaving S&P 500\n",
"(\n",
" ticker_record_df.groupby(\"ticker\")[\"start_date\"]\n",
" .count().sort_values(ascending=False)\n",
Expand All @@ -265,7 +265,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "30739501-b01d-4840-a03d-975ab2791d31",
"metadata": {},
"outputs": [],
Expand All @@ -279,17 +279,17 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "31288233-b806-4c0d-9105-0ff87da3c772",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1163"
"1168"
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -300,17 +300,17 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "d1127e76-cc08-4146-98ad-e045ec431399",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1211"
"1216"
]
},
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -321,7 +321,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"id": "1b90c49b-0cb0-4772-89d3-1a3cbf7ef3a8",
"metadata": {},
"outputs": [],
Expand All @@ -348,7 +348,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 545a1a9

Please sign in to comment.