Hanna Prutsakova commited on
Commit
751aac5
1 Parent(s): 6972291
Files changed (1) hide show
  1. test.ipynb +66 -22
test.ipynb CHANGED
@@ -29,23 +29,13 @@
29
  },
30
  {
31
  "cell_type": "markdown",
32
- "id": "c0531a97",
33
  "metadata": {},
34
  "source": [
35
  "# Stock exchange prices visualization\n",
36
  "## File should contain: Date, Open, High, Low, Close, Adj Close, Volume"
37
  ]
38
  },
39
- {
40
- "cell_type": "code",
41
- "execution_count": null,
42
- "id": "ac059883",
43
- "metadata": {},
44
- "outputs": [],
45
- "source": [
46
- "print(\"File Format: Date, Open, High, Low, Close, Adj Close, Volume\")"
47
- ]
48
- },
49
  {
50
  "cell_type": "code",
51
  "execution_count": 2,
@@ -134,7 +124,7 @@
134
  "execution_count": 6,
135
  "id": "chief-dream",
136
  "metadata": {
137
- "scrolled": false
138
  },
139
  "outputs": [
140
  {
@@ -153,11 +143,21 @@
153
  "df.Date = pd.to_datetime(df.Date)"
154
  ]
155
  },
 
 
 
 
 
 
 
 
156
  {
157
  "cell_type": "code",
158
  "execution_count": 7,
159
  "id": "arbitrary-alexandria",
160
- "metadata": {},
 
 
161
  "outputs": [
162
  {
163
  "ename": "NameError",
@@ -172,7 +172,7 @@
172
  }
173
  ],
174
  "source": [
175
- "fig = px.line(df, x='Date', y='High', title='Line graph of High')\n",
176
  "\n",
177
  "fig.update_xaxes(\n",
178
  " rangeselector=dict(\n",
@@ -187,11 +187,21 @@
187
  "fig.show()"
188
  ]
189
  },
 
 
 
 
 
 
 
 
190
  {
191
  "cell_type": "code",
192
  "execution_count": 8,
193
  "id": "cleared-potential",
194
- "metadata": {},
 
 
195
  "outputs": [
196
  {
197
  "ename": "NameError",
@@ -206,7 +216,7 @@
206
  }
207
  ],
208
  "source": [
209
- "fig = px.area(df, x='Date', y='Close', title='Area graph of Close')\n",
210
  "\n",
211
  "fig.update_xaxes(\n",
212
  " rangeselector=dict(\n",
@@ -221,11 +231,21 @@
221
  "fig.show()"
222
  ]
223
  },
 
 
 
 
 
 
 
 
224
  {
225
  "cell_type": "code",
226
  "execution_count": 9,
227
  "id": "adopted-preliminary",
228
- "metadata": {},
 
 
229
  "outputs": [
230
  {
231
  "name": "stdout",
@@ -247,7 +267,6 @@
247
  }
248
  ],
249
  "source": [
250
- "print(\"Bar plot. Rising value colored red, dropping value colored green.\")\n",
251
  "df3 = df.drop(['Open', 'Adj Close', 'Low', 'Close', 'Volume'], axis=1)\n",
252
  "colors = ['red' if df3['High'][i+1] < df3['High'][i] else 'green' for i in range(len(df3)-1)]\n",
253
  "\n",
@@ -266,6 +285,14 @@
266
  "fig2.show()"
267
  ]
268
  },
 
 
 
 
 
 
 
 
269
  {
270
  "cell_type": "code",
271
  "execution_count": 10,
@@ -285,15 +312,25 @@
285
  }
286
  ],
287
  "source": [
288
- "fig = px.box(df, y=\"Adj Close\", title = \"Box plot of Adj Close\")\n",
289
  "fig.show()"
290
  ]
291
  },
 
 
 
 
 
 
 
 
292
  {
293
  "cell_type": "code",
294
  "execution_count": 11,
295
  "id": "derived-colorado",
296
- "metadata": {},
 
 
297
  "outputs": [
298
  {
299
  "ename": "NameError",
@@ -308,7 +345,6 @@
308
  }
309
  ],
310
  "source": [
311
- "print(\"Ohlc plot. Rising value colored red, dropping value colored green.\")\n",
312
  "fig3 = go.Figure(data=go.Ohlc(x=df['Date'],\n",
313
  " open=df['Open'],\n",
314
  " high=df['High'],\n",
@@ -327,6 +363,14 @@
327
  "fig3.show()"
328
  ]
329
  },
 
 
 
 
 
 
 
 
330
  {
331
  "cell_type": "code",
332
  "execution_count": null,
@@ -334,7 +378,7 @@
334
  "metadata": {},
335
  "outputs": [],
336
  "source": [
337
- "fig = px.scatter_matrix(df, title = \"Matrix of scatter plots\")\n",
338
  "fig.show()"
339
  ]
340
  },
 
29
  },
30
  {
31
  "cell_type": "markdown",
32
+ "id": "3d7bc559",
33
  "metadata": {},
34
  "source": [
35
  "# Stock exchange prices visualization\n",
36
  "## File should contain: Date, Open, High, Low, Close, Adj Close, Volume"
37
  ]
38
  },
 
 
 
 
 
 
 
 
 
 
39
  {
40
  "cell_type": "code",
41
  "execution_count": 2,
 
124
  "execution_count": 6,
125
  "id": "chief-dream",
126
  "metadata": {
127
+ "scrolled": true
128
  },
129
  "outputs": [
130
  {
 
143
  "df.Date = pd.to_datetime(df.Date)"
144
  ]
145
  },
146
+ {
147
+ "cell_type": "markdown",
148
+ "id": "bcbc4487",
149
+ "metadata": {},
150
+ "source": [
151
+ "### Line graph of High"
152
+ ]
153
+ },
154
  {
155
  "cell_type": "code",
156
  "execution_count": 7,
157
  "id": "arbitrary-alexandria",
158
+ "metadata": {
159
+ "scrolled": true
160
+ },
161
  "outputs": [
162
  {
163
  "ename": "NameError",
 
172
  }
173
  ],
174
  "source": [
175
+ "fig = px.line(df, x='Date', y='High')\n",
176
  "\n",
177
  "fig.update_xaxes(\n",
178
  " rangeselector=dict(\n",
 
187
  "fig.show()"
188
  ]
189
  },
190
+ {
191
+ "cell_type": "markdown",
192
+ "id": "46ef20e7",
193
+ "metadata": {},
194
+ "source": [
195
+ "### Area graph of Close"
196
+ ]
197
+ },
198
  {
199
  "cell_type": "code",
200
  "execution_count": 8,
201
  "id": "cleared-potential",
202
+ "metadata": {
203
+ "scrolled": true
204
+ },
205
  "outputs": [
206
  {
207
  "ename": "NameError",
 
216
  }
217
  ],
218
  "source": [
219
+ "fig = px.area(df, x='Date', y='Close')\n",
220
  "\n",
221
  "fig.update_xaxes(\n",
222
  " rangeselector=dict(\n",
 
231
  "fig.show()"
232
  ]
233
  },
234
+ {
235
+ "cell_type": "markdown",
236
+ "id": "8b5738fb",
237
+ "metadata": {},
238
+ "source": [
239
+ "### Bar plot. Rising value colored red, dropping value colored green."
240
+ ]
241
+ },
242
  {
243
  "cell_type": "code",
244
  "execution_count": 9,
245
  "id": "adopted-preliminary",
246
+ "metadata": {
247
+ "scrolled": true
248
+ },
249
  "outputs": [
250
  {
251
  "name": "stdout",
 
267
  }
268
  ],
269
  "source": [
 
270
  "df3 = df.drop(['Open', 'Adj Close', 'Low', 'Close', 'Volume'], axis=1)\n",
271
  "colors = ['red' if df3['High'][i+1] < df3['High'][i] else 'green' for i in range(len(df3)-1)]\n",
272
  "\n",
 
285
  "fig2.show()"
286
  ]
287
  },
288
+ {
289
+ "cell_type": "markdown",
290
+ "id": "b008b4c1",
291
+ "metadata": {},
292
+ "source": [
293
+ "### Box plot of Adj Close"
294
+ ]
295
+ },
296
  {
297
  "cell_type": "code",
298
  "execution_count": 10,
 
312
  }
313
  ],
314
  "source": [
315
+ "fig = px.box(df, y=\"Adj Close\")\n",
316
  "fig.show()"
317
  ]
318
  },
319
+ {
320
+ "cell_type": "markdown",
321
+ "id": "323dba84",
322
+ "metadata": {},
323
+ "source": [
324
+ "### Ohlc plot. Rising value colored red, dropping value colored green."
325
+ ]
326
+ },
327
  {
328
  "cell_type": "code",
329
  "execution_count": 11,
330
  "id": "derived-colorado",
331
+ "metadata": {
332
+ "scrolled": true
333
+ },
334
  "outputs": [
335
  {
336
  "ename": "NameError",
 
345
  }
346
  ],
347
  "source": [
 
348
  "fig3 = go.Figure(data=go.Ohlc(x=df['Date'],\n",
349
  " open=df['Open'],\n",
350
  " high=df['High'],\n",
 
363
  "fig3.show()"
364
  ]
365
  },
366
+ {
367
+ "cell_type": "markdown",
368
+ "id": "04a2404e",
369
+ "metadata": {},
370
+ "source": [
371
+ "### Matrix of scatter plots"
372
+ ]
373
+ },
374
  {
375
  "cell_type": "code",
376
  "execution_count": null,
 
378
  "metadata": {},
379
  "outputs": [],
380
  "source": [
381
+ "fig = px.scatter_matrix(df)\n",
382
  "fig.show()"
383
  ]
384
  },