Hanna Prutsakova
commited on
Commit
•
c680eb9
1
Parent(s):
365ada6
first
Browse files- .ipynb_checkpoints/test-checkpoint.ipynb +348 -0
- AA.csv +0 -0
- test.ipynb +0 -0
.ipynb_checkpoints/test-checkpoint.ipynb
ADDED
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"id": "sublime-jungle",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [
|
9 |
+
{
|
10 |
+
"ename": "SyntaxError",
|
11 |
+
"evalue": "invalid syntax (2178465500.py, line 1)",
|
12 |
+
"output_type": "error",
|
13 |
+
"traceback": [
|
14 |
+
"\u001b[0;36m File \u001b[0;32m\"/var/folders/q0/8v33llq51sj14jdhw1s7f1mr0000gn/T/ipykernel_87978/2178465500.py\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m ---\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
|
15 |
+
]
|
16 |
+
}
|
17 |
+
],
|
18 |
+
"source": [
|
19 |
+
"---\n",
|
20 |
+
"title: Upload file demo\n",
|
21 |
+
"description: Stocks visualization\n",
|
22 |
+
"show-code: False\n",
|
23 |
+
"params:\n",
|
24 |
+
" filename:\n",
|
25 |
+
" input: file\n",
|
26 |
+
" label: Please upload CSV file\n",
|
27 |
+
"---"
|
28 |
+
]
|
29 |
+
},
|
30 |
+
{
|
31 |
+
"cell_type": "code",
|
32 |
+
"execution_count": 2,
|
33 |
+
"id": "bright-captain",
|
34 |
+
"metadata": {},
|
35 |
+
"outputs": [],
|
36 |
+
"source": [
|
37 |
+
"filename = \"AA.csv\""
|
38 |
+
]
|
39 |
+
},
|
40 |
+
{
|
41 |
+
"cell_type": "code",
|
42 |
+
"execution_count": 3,
|
43 |
+
"id": "settled-philippines",
|
44 |
+
"metadata": {},
|
45 |
+
"outputs": [
|
46 |
+
{
|
47 |
+
"data": {
|
48 |
+
"text/html": [
|
49 |
+
" <script type=\"text/javascript\">\n",
|
50 |
+
" window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
|
51 |
+
" if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
|
52 |
+
" if (typeof require !== 'undefined') {\n",
|
53 |
+
" require.undef(\"plotly\");\n",
|
54 |
+
" requirejs.config({\n",
|
55 |
+
" paths: {\n",
|
56 |
+
" 'plotly': ['https://cdn.plot.ly/plotly-2.6.3.min']\n",
|
57 |
+
" }\n",
|
58 |
+
" });\n",
|
59 |
+
" require(['plotly'], function(Plotly) {\n",
|
60 |
+
" window._Plotly = Plotly;\n",
|
61 |
+
" });\n",
|
62 |
+
" }\n",
|
63 |
+
" </script>\n",
|
64 |
+
" "
|
65 |
+
]
|
66 |
+
},
|
67 |
+
"metadata": {},
|
68 |
+
"output_type": "display_data"
|
69 |
+
}
|
70 |
+
],
|
71 |
+
"source": [
|
72 |
+
"import pandas as pd\n",
|
73 |
+
"import numpy as np\n",
|
74 |
+
"import time\n",
|
75 |
+
"import plotly as py\n",
|
76 |
+
"import plotly.graph_objs as go\n",
|
77 |
+
"import plotly.express as px\n",
|
78 |
+
"from plotly.offline import init_notebook_mode\n",
|
79 |
+
"import plotly.graph_objects as go\n",
|
80 |
+
"init_notebook_mode(connected = True)"
|
81 |
+
]
|
82 |
+
},
|
83 |
+
{
|
84 |
+
"cell_type": "code",
|
85 |
+
"execution_count": 4,
|
86 |
+
"id": "steady-nerve",
|
87 |
+
"metadata": {},
|
88 |
+
"outputs": [
|
89 |
+
{
|
90 |
+
"ename": "FileNotFoundError",
|
91 |
+
"evalue": "[Errno 2] No such file or directory: 'AA.csv'",
|
92 |
+
"output_type": "error",
|
93 |
+
"traceback": [
|
94 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
95 |
+
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
|
96 |
+
"\u001b[0;32m/var/folders/q0/8v33llq51sj14jdhw1s7f1mr0000gn/T/ipykernel_87978/2381305835.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
97 |
+
"\u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/pandas/util/_decorators.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 309\u001b[0m \u001b[0mstacklevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstacklevel\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 310\u001b[0m )\n\u001b[0;32m--> 311\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 312\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 313\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
98 |
+
"\u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/pandas/io/parsers/readers.py\u001b[0m in \u001b[0;36mread_csv\u001b[0;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, error_bad_lines, warn_bad_lines, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options)\u001b[0m\n\u001b[1;32m 584\u001b[0m \u001b[0mkwds\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkwds_defaults\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 585\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 586\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0m_read\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 587\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 588\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
|
99 |
+
"\u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/pandas/io/parsers/readers.py\u001b[0m in \u001b[0;36m_read\u001b[0;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[1;32m 480\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 481\u001b[0m \u001b[0;31m# Create the parser.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 482\u001b[0;31m \u001b[0mparser\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mTextFileReader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 483\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mchunksize\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0miterator\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
100 |
+
"\u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/pandas/io/parsers/readers.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, f, engine, **kwds)\u001b[0m\n\u001b[1;32m 809\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moptions\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"has_index_names\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwds\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"has_index_names\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 810\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 811\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_make_engine\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mengine\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 812\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 813\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
101 |
+
"\u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/pandas/io/parsers/readers.py\u001b[0m in \u001b[0;36m_make_engine\u001b[0;34m(self, engine)\u001b[0m\n\u001b[1;32m 1038\u001b[0m )\n\u001b[1;32m 1039\u001b[0m \u001b[0;31m# error: Too many arguments for \"ParserBase\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1040\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmapping\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mengine\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moptions\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# type: ignore[call-arg]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1041\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1042\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_failover_to_python\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
102 |
+
"\u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/pandas/io/parsers/c_parser_wrapper.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, src, **kwds)\u001b[0m\n\u001b[1;32m 49\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;31m# open handles\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 51\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_open_handles\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msrc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 52\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhandles\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
|
103 |
+
"\u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/pandas/io/parsers/base_parser.py\u001b[0m in \u001b[0;36m_open_handles\u001b[0;34m(self, src, kwds)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0mLet\u001b[0m \u001b[0mthe\u001b[0m \u001b[0mreaders\u001b[0m \u001b[0mopen\u001b[0m \u001b[0mIOHandles\u001b[0m \u001b[0mafter\u001b[0m \u001b[0mthey\u001b[0m \u001b[0mare\u001b[0m \u001b[0mdone\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mtheir\u001b[0m \u001b[0mpotential\u001b[0m \u001b[0mraises\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \"\"\"\n\u001b[0;32m--> 222\u001b[0;31m self.handles = get_handle(\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0msrc\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;34m\"r\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
104 |
+
"\u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/pandas/io/common.py\u001b[0m in \u001b[0;36mget_handle\u001b[0;34m(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)\u001b[0m\n\u001b[1;32m 700\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mioargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mencoding\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m\"b\"\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mioargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 701\u001b[0m \u001b[0;31m# Encoding\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 702\u001b[0;31m handle = open(\n\u001b[0m\u001b[1;32m 703\u001b[0m \u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 704\u001b[0m \u001b[0mioargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
105 |
+
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'AA.csv'"
|
106 |
+
]
|
107 |
+
}
|
108 |
+
],
|
109 |
+
"source": [
|
110 |
+
"df = pd.read_csv(filename)"
|
111 |
+
]
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"cell_type": "code",
|
115 |
+
"execution_count": 6,
|
116 |
+
"id": "chief-dream",
|
117 |
+
"metadata": {
|
118 |
+
"scrolled": false
|
119 |
+
},
|
120 |
+
"outputs": [
|
121 |
+
{
|
122 |
+
"ename": "NameError",
|
123 |
+
"evalue": "name 'df' is not defined",
|
124 |
+
"output_type": "error",
|
125 |
+
"traceback": [
|
126 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
127 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
128 |
+
"\u001b[0;32m/var/folders/q0/8v33llq51sj14jdhw1s7f1mr0000gn/T/ipykernel_87956/4238552302.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDate\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_datetime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDate\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
129 |
+
"\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
|
130 |
+
]
|
131 |
+
}
|
132 |
+
],
|
133 |
+
"source": [
|
134 |
+
"df.Date = pd.to_datetime(df.Date)"
|
135 |
+
]
|
136 |
+
},
|
137 |
+
{
|
138 |
+
"cell_type": "code",
|
139 |
+
"execution_count": 7,
|
140 |
+
"id": "arbitrary-alexandria",
|
141 |
+
"metadata": {},
|
142 |
+
"outputs": [
|
143 |
+
{
|
144 |
+
"ename": "NameError",
|
145 |
+
"evalue": "name 'df' is not defined",
|
146 |
+
"output_type": "error",
|
147 |
+
"traceback": [
|
148 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
149 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
150 |
+
"\u001b[0;32m/var/folders/q0/8v33llq51sj14jdhw1s7f1mr0000gn/T/ipykernel_87956/2998064103.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfig\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'Date'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'High'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtitle\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'Line graph of High'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m fig.update_xaxes(\n\u001b[1;32m 4\u001b[0m rangeselector=dict(\n\u001b[1;32m 5\u001b[0m buttons=list([\n",
|
151 |
+
"\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
|
152 |
+
]
|
153 |
+
}
|
154 |
+
],
|
155 |
+
"source": [
|
156 |
+
"fig = px.line(df, x='Date', y='High', title='Line graph of High')\n",
|
157 |
+
"\n",
|
158 |
+
"fig.update_xaxes(\n",
|
159 |
+
" rangeselector=dict(\n",
|
160 |
+
" buttons=list([\n",
|
161 |
+
" dict(count=1, label=\"1m\", step=\"month\", stepmode=\"backward\"),\n",
|
162 |
+
" dict(count=6, label=\"6m\", step=\"month\", stepmode=\"backward\"),\n",
|
163 |
+
" dict(count=1, label=\"1y\", step=\"year\", stepmode=\"backward\"),\n",
|
164 |
+
" dict(step=\"all\")\n",
|
165 |
+
" ])\n",
|
166 |
+
" )\n",
|
167 |
+
")\n",
|
168 |
+
"fig.show()"
|
169 |
+
]
|
170 |
+
},
|
171 |
+
{
|
172 |
+
"cell_type": "code",
|
173 |
+
"execution_count": 8,
|
174 |
+
"id": "cleared-potential",
|
175 |
+
"metadata": {},
|
176 |
+
"outputs": [
|
177 |
+
{
|
178 |
+
"ename": "NameError",
|
179 |
+
"evalue": "name 'df' is not defined",
|
180 |
+
"output_type": "error",
|
181 |
+
"traceback": [
|
182 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
183 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
184 |
+
"\u001b[0;32m/var/folders/q0/8v33llq51sj14jdhw1s7f1mr0000gn/T/ipykernel_87956/1297807080.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfig\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marea\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'Date'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'High'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtitle\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'Area graph of High'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m fig.update_xaxes(\n\u001b[1;32m 4\u001b[0m rangeselector=dict(\n\u001b[1;32m 5\u001b[0m buttons=list([\n",
|
185 |
+
"\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
|
186 |
+
]
|
187 |
+
}
|
188 |
+
],
|
189 |
+
"source": [
|
190 |
+
"fig = px.area(df, x='Date', y='High', title='Area graph of High')\n",
|
191 |
+
"\n",
|
192 |
+
"fig.update_xaxes(\n",
|
193 |
+
" rangeselector=dict(\n",
|
194 |
+
" buttons=list([\n",
|
195 |
+
" dict(count=1, label=\"1m\", step=\"month\", stepmode=\"backward\"),\n",
|
196 |
+
" dict(count=6, label=\"6m\", step=\"month\", stepmode=\"backward\"),\n",
|
197 |
+
" dict(count=1, label=\"1y\", step=\"year\", stepmode=\"backward\"),\n",
|
198 |
+
" dict(step=\"all\")\n",
|
199 |
+
" ])\n",
|
200 |
+
" )\n",
|
201 |
+
")\n",
|
202 |
+
"fig.show()"
|
203 |
+
]
|
204 |
+
},
|
205 |
+
{
|
206 |
+
"cell_type": "code",
|
207 |
+
"execution_count": 9,
|
208 |
+
"id": "adopted-preliminary",
|
209 |
+
"metadata": {},
|
210 |
+
"outputs": [
|
211 |
+
{
|
212 |
+
"name": "stdout",
|
213 |
+
"output_type": "stream",
|
214 |
+
"text": [
|
215 |
+
"Bar plot. Dropping value colored red, rising value colored green.\n"
|
216 |
+
]
|
217 |
+
},
|
218 |
+
{
|
219 |
+
"ename": "NameError",
|
220 |
+
"evalue": "name 'df' is not defined",
|
221 |
+
"output_type": "error",
|
222 |
+
"traceback": [
|
223 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
224 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
225 |
+
"\u001b[0;32m/var/folders/q0/8v33llq51sj14jdhw1s7f1mr0000gn/T/ipykernel_87956/133230993.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Bar plot. Dropping value colored red, rising value colored green.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mdf3\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Open'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Adj Close'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Low'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Close'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Volume'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mcolors\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'red'\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdf3\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'High'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0mdf3\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'High'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0;34m'green'\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf3\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mdataTrace\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgo\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mBar\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdf3\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Date'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdf3\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'High'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmarker\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcolor\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcolors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'Data'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
226 |
+
"\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
|
227 |
+
]
|
228 |
+
}
|
229 |
+
],
|
230 |
+
"source": [
|
231 |
+
"print(\"Bar plot. Dropping value colored red, rising value colored green.\")\n",
|
232 |
+
"df3 = df.drop(['Open', 'Adj Close', 'Low', 'Close', 'Volume'], axis=1)\n",
|
233 |
+
"colors = ['red' if df3['High'][i+1] < df3['High'][i] else 'green' for i in range(len(df3)-1)]\n",
|
234 |
+
"\n",
|
235 |
+
"dataTrace = go.Bar(x=df3['Date'], y=df3['High'], marker=dict(color=colors), name='Data')\n",
|
236 |
+
"fig2 = go.Figure(data=dataTrace)\n",
|
237 |
+
"fig2.update_xaxes(\n",
|
238 |
+
" rangeselector=dict(\n",
|
239 |
+
" buttons=list([\n",
|
240 |
+
" dict(count=1, label=\"1m\", step=\"month\", stepmode=\"backward\"),\n",
|
241 |
+
" dict(count=6, label=\"6m\", step=\"month\", stepmode=\"backward\"),\n",
|
242 |
+
" dict(count=1, label=\"1y\", step=\"year\", stepmode=\"backward\"),\n",
|
243 |
+
" dict(step=\"all\")\n",
|
244 |
+
" ])\n",
|
245 |
+
" )\n",
|
246 |
+
")\n",
|
247 |
+
"fig2.show()"
|
248 |
+
]
|
249 |
+
},
|
250 |
+
{
|
251 |
+
"cell_type": "code",
|
252 |
+
"execution_count": 10,
|
253 |
+
"id": "responsible-venture",
|
254 |
+
"metadata": {},
|
255 |
+
"outputs": [
|
256 |
+
{
|
257 |
+
"ename": "NameError",
|
258 |
+
"evalue": "name 'df' is not defined",
|
259 |
+
"output_type": "error",
|
260 |
+
"traceback": [
|
261 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
262 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
263 |
+
"\u001b[0;32m/var/folders/q0/8v33llq51sj14jdhw1s7f1mr0000gn/T/ipykernel_87956/29852954.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfig\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbox\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Adj Close\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtitle\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"Box plot of Adj Close\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mfig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
264 |
+
"\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
|
265 |
+
]
|
266 |
+
}
|
267 |
+
],
|
268 |
+
"source": [
|
269 |
+
"fig = px.box(df, y=\"Adj Close\", title = \"Box plot of Adj Close\")\n",
|
270 |
+
"fig.show()"
|
271 |
+
]
|
272 |
+
},
|
273 |
+
{
|
274 |
+
"cell_type": "code",
|
275 |
+
"execution_count": 11,
|
276 |
+
"id": "derived-colorado",
|
277 |
+
"metadata": {},
|
278 |
+
"outputs": [
|
279 |
+
{
|
280 |
+
"ename": "NameError",
|
281 |
+
"evalue": "name 'df' is not defined",
|
282 |
+
"output_type": "error",
|
283 |
+
"traceback": [
|
284 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
285 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
286 |
+
"\u001b[0;32m/var/folders/q0/8v33llq51sj14jdhw1s7f1mr0000gn/T/ipykernel_87956/1318489436.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m fig3 = go.Figure(data=go.Ohlc(x=df['Date'],\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Open'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mhigh\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'High'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mlow\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Low'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m close=df['Close']))\n",
|
287 |
+
"\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
|
288 |
+
]
|
289 |
+
}
|
290 |
+
],
|
291 |
+
"source": [
|
292 |
+
"fig3 = go.Figure(data=go.Ohlc(x=df['Date'],\n",
|
293 |
+
" open=df['Open'],\n",
|
294 |
+
" high=df['High'],\n",
|
295 |
+
" low=df['Low'],\n",
|
296 |
+
" close=df['Close']))\n",
|
297 |
+
"fig3.update_xaxes(\n",
|
298 |
+
" rangeselector=dict(\n",
|
299 |
+
" buttons=list([\n",
|
300 |
+
" dict(count=1, label=\"1m\", step=\"month\", stepmode=\"backward\"),\n",
|
301 |
+
" dict(count=6, label=\"6m\", step=\"month\", stepmode=\"backward\"),\n",
|
302 |
+
" dict(count=1, label=\"1y\", step=\"year\", stepmode=\"backward\"),\n",
|
303 |
+
" dict(step=\"all\")\n",
|
304 |
+
" ])\n",
|
305 |
+
" )\n",
|
306 |
+
")\n",
|
307 |
+
"fig3.show()"
|
308 |
+
]
|
309 |
+
},
|
310 |
+
{
|
311 |
+
"cell_type": "code",
|
312 |
+
"execution_count": null,
|
313 |
+
"id": "growing-burner",
|
314 |
+
"metadata": {},
|
315 |
+
"outputs": [],
|
316 |
+
"source": []
|
317 |
+
},
|
318 |
+
{
|
319 |
+
"cell_type": "code",
|
320 |
+
"execution_count": null,
|
321 |
+
"id": "transparent-transcript",
|
322 |
+
"metadata": {},
|
323 |
+
"outputs": [],
|
324 |
+
"source": []
|
325 |
+
}
|
326 |
+
],
|
327 |
+
"metadata": {
|
328 |
+
"kernelspec": {
|
329 |
+
"display_name": "Python 3 (ipykernel)",
|
330 |
+
"language": "python",
|
331 |
+
"name": "python3"
|
332 |
+
},
|
333 |
+
"language_info": {
|
334 |
+
"codemirror_mode": {
|
335 |
+
"name": "ipython",
|
336 |
+
"version": 3
|
337 |
+
},
|
338 |
+
"file_extension": ".py",
|
339 |
+
"mimetype": "text/x-python",
|
340 |
+
"name": "python",
|
341 |
+
"nbconvert_exporter": "python",
|
342 |
+
"pygments_lexer": "ipython3",
|
343 |
+
"version": "3.9.8"
|
344 |
+
}
|
345 |
+
},
|
346 |
+
"nbformat": 4,
|
347 |
+
"nbformat_minor": 5
|
348 |
+
}
|
AA.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
test.ipynb
CHANGED
The diff for this file is too large to render.
See raw diff
|
|