File size: 7,042 Bytes
32b2ff4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_apple = pd.read_csv('../coal-price-data/investing/AAPL Historical Data.csv')\n",
    "df_walmart = pd.read_csv('../coal-price-data/investing/WMT Historical Data.csv')\n",
    "df_tesla = pd.read_csv('../coal-price-data/investing/TSLA Historical Data.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Date</th>\n",
       "      <th>Price</th>\n",
       "      <th>Open</th>\n",
       "      <th>High</th>\n",
       "      <th>Low</th>\n",
       "      <th>Vol.</th>\n",
       "      <th>Change %</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>02/01/2024</td>\n",
       "      <td>182.52</td>\n",
       "      <td>183.97</td>\n",
       "      <td>191.00</td>\n",
       "      <td>179.26</td>\n",
       "      <td>45.12M</td>\n",
       "      <td>-1.02%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>01/01/2024</td>\n",
       "      <td>184.40</td>\n",
       "      <td>187.15</td>\n",
       "      <td>196.38</td>\n",
       "      <td>180.17</td>\n",
       "      <td>1.19B</td>\n",
       "      <td>-4.22%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>12/01/2023</td>\n",
       "      <td>192.53</td>\n",
       "      <td>190.33</td>\n",
       "      <td>199.62</td>\n",
       "      <td>187.45</td>\n",
       "      <td>1.06B</td>\n",
       "      <td>1.36%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>11/01/2023</td>\n",
       "      <td>189.95</td>\n",
       "      <td>171.00</td>\n",
       "      <td>192.93</td>\n",
       "      <td>170.12</td>\n",
       "      <td>1.10B</td>\n",
       "      <td>11.23%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10/01/2023</td>\n",
       "      <td>170.77</td>\n",
       "      <td>171.22</td>\n",
       "      <td>182.34</td>\n",
       "      <td>165.67</td>\n",
       "      <td>1.17B</td>\n",
       "      <td>-0.26%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>513</th>\n",
       "      <td>05/01/1981</td>\n",
       "      <td>0.15</td>\n",
       "      <td>0.13</td>\n",
       "      <td>0.15</td>\n",
       "      <td>0.12</td>\n",
       "      <td>590.42M</td>\n",
       "      <td>15.38%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>514</th>\n",
       "      <td>04/01/1981</td>\n",
       "      <td>0.13</td>\n",
       "      <td>0.11</td>\n",
       "      <td>0.13</td>\n",
       "      <td>0.11</td>\n",
       "      <td>536.93M</td>\n",
       "      <td>18.18%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>515</th>\n",
       "      <td>03/01/1981</td>\n",
       "      <td>0.11</td>\n",
       "      <td>0.12</td>\n",
       "      <td>0.12</td>\n",
       "      <td>0.10</td>\n",
       "      <td>700.72M</td>\n",
       "      <td>-8.33%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>516</th>\n",
       "      <td>02/01/1981</td>\n",
       "      <td>0.12</td>\n",
       "      <td>0.12</td>\n",
       "      <td>0.13</td>\n",
       "      <td>0.11</td>\n",
       "      <td>321.62M</td>\n",
       "      <td>-7.69%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>517</th>\n",
       "      <td>01/01/1981</td>\n",
       "      <td>0.13</td>\n",
       "      <td>0.15</td>\n",
       "      <td>0.16</td>\n",
       "      <td>0.13</td>\n",
       "      <td>608.99M</td>\n",
       "      <td>-13.33%</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>518 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           Date   Price    Open    High     Low     Vol. Change %\n",
       "0    02/01/2024  182.52  183.97  191.00  179.26   45.12M   -1.02%\n",
       "1    01/01/2024  184.40  187.15  196.38  180.17    1.19B   -4.22%\n",
       "2    12/01/2023  192.53  190.33  199.62  187.45    1.06B    1.36%\n",
       "3    11/01/2023  189.95  171.00  192.93  170.12    1.10B   11.23%\n",
       "4    10/01/2023  170.77  171.22  182.34  165.67    1.17B   -0.26%\n",
       "..          ...     ...     ...     ...     ...      ...      ...\n",
       "513  05/01/1981    0.15    0.13    0.15    0.12  590.42M   15.38%\n",
       "514  04/01/1981    0.13    0.11    0.13    0.11  536.93M   18.18%\n",
       "515  03/01/1981    0.11    0.12    0.12    0.10  700.72M   -8.33%\n",
       "516  02/01/1981    0.12    0.12    0.13    0.11  321.62M   -7.69%\n",
       "517  01/01/1981    0.13    0.15    0.16    0.13  608.99M  -13.33%\n",
       "\n",
       "[518 rows x 7 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_apple"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.merge(df_apple[['Date', 'Adj Close']], df_walmart[['Date', 'Adj Close']], on='Date', how='right').rename(columns = {'Adj Close_x':'apple', 'Adj Close_y':'walmart'})\n",
    "df = df.merge(df_tesla[['Date', 'Adj Close']], on='Date', how='right').rename(columns={'Adj Close':'tesla'})"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py311-kfp240-airflow251",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}