|
52 | 52 | },
|
53 | 53 | {
|
54 | 54 | "cell_type": "code",
|
55 |
| - "execution_count": 2, |
| 55 | + "execution_count": 1, |
56 | 56 | "metadata": {
|
57 | 57 | "collapsed": false,
|
58 | 58 | "scrolled": true
|
|
61 | 61 | {
|
62 | 62 | "data": {
|
63 | 63 | "text/html": [
|
64 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~AdamKulidjian/2193.embed\" height=\"380px\" width=\"100%\"></iframe>" |
| 64 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/3014.embed\" height=\"380px\" width=\"100%\"></iframe>" |
65 | 65 | ],
|
66 | 66 | "text/plain": [
|
67 | 67 | "<plotly.tools.PlotlyDisplay object>"
|
68 | 68 | ]
|
69 | 69 | },
|
70 |
| - "execution_count": 2, |
| 70 | + "execution_count": 1, |
71 | 71 | "metadata": {},
|
72 | 72 | "output_type": "execute_result"
|
73 | 73 | }
|
|
81 | 81 | "from datetime import datetime\n",
|
82 | 82 | "import numpy as np\n",
|
83 | 83 | "import pandas as pd\n",
|
84 |
| - "import pandas_datareader.data as web\n", |
85 | 84 | "\n",
|
86 |
| - "appl = web.get_data_yahoo('AAPL', '2016-01-01', '2016-11-30')\n", |
87 |
| - "apple_data_matrix = appl.head(10)\n", |
| 85 | + "appl = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')\n", |
| 86 | + "appl.columns = [col.replace('AAPL.', '') for col in appl.columns]\n", |
| 87 | + "apple_data_matrix = appl.head(10).round(2)\n", |
88 | 88 | "\n",
|
89 | 89 | "table = FF.create_table(apple_data_matrix)\n",
|
90 | 90 | "py.iplot(table, filename='apple_data_table')"
|
|
99 | 99 | },
|
100 | 100 | {
|
101 | 101 | "cell_type": "code",
|
102 |
| - "execution_count": 3, |
| 102 | + "execution_count": 2, |
103 | 103 | "metadata": {
|
104 | 104 | "collapsed": false
|
105 | 105 | },
|
106 | 106 | "outputs": [
|
107 | 107 | {
|
108 | 108 | "data": {
|
109 | 109 | "text/plain": [
|
110 |
| - "u'https://plot.ly/~AdamKulidjian/2201/'" |
| 110 | + "'https://plot.ly/~PythonPlotBot/3031/'" |
111 | 111 | ]
|
112 | 112 | },
|
113 |
| - "execution_count": 3, |
| 113 | + "execution_count": 2, |
114 | 114 | "metadata": {},
|
115 | 115 | "output_type": "execute_result"
|
116 | 116 | }
|
|
120 | 120 | " epoch = datetime.utcfromtimestamp(0)\n",
|
121 | 121 | " return (dt - epoch).total_seconds() * 1000\n",
|
122 | 122 | "\n",
|
123 |
| - "appl_price = list(appl['Adj Close'])\n", |
| 123 | + "appl_price = list(appl['Adjusted'])\n", |
124 | 124 | "my_columns = []\n",
|
125 |
| - "for k in range(len(appl.index) - 1):\n", |
126 |
| - " my_columns.append(Column(appl.index[:k + 1], 'x{}'.format(k + 1))) \n", |
| 125 | + "for k in range(len(appl.Date) - 1):\n", |
| 126 | + " my_columns.append(Column(list(appl.Date)[:k + 1], 'x{}'.format(k + 1))) \n", |
127 | 127 | " my_columns.append(Column(appl_price[:k + 1], 'y{}'.format(k + 1)))\n",
|
128 | 128 | "grid = Grid(my_columns)\n",
|
129 | 129 | "py.grid_ops.upload(grid, 'AAPL-daily-stock-price' + str(time.time()), auto_open=False)"
|
|
138 | 138 | },
|
139 | 139 | {
|
140 | 140 | "cell_type": "code",
|
141 |
| - "execution_count": 4, |
| 141 | + "execution_count": 3, |
142 | 142 | "metadata": {
|
143 | 143 | "collapsed": false
|
144 | 144 | },
|
145 | 145 | "outputs": [
|
146 | 146 | {
|
147 | 147 | "data": {
|
148 | 148 | "text/html": [
|
149 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~AdamKulidjian/2202.embed\" height=\"400px\" width=\"800px\"></iframe>" |
| 149 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/3032.embed\" height=\"400px\" width=\"800px\"></iframe>" |
150 | 150 | ],
|
151 | 151 | "text/plain": [
|
152 | 152 | "<plotly.tools.PlotlyDisplay object>"
|
153 | 153 | ]
|
154 | 154 | },
|
155 |
| - "execution_count": 4, |
| 155 | + "execution_count": 3, |
156 | 156 | "metadata": {},
|
157 | 157 | "output_type": "execute_result"
|
158 | 158 | }
|
|
181 | 181 | " width=800,\n",
|
182 | 182 | " height=400,\n",
|
183 | 183 | " xaxis=dict(axis, **{'nticks':12, 'tickangle':-45,\n",
|
184 |
| - " 'range': [to_unix_time(datetime(2016, 1, 4)),\n", |
| 184 | + " 'range': [to_unix_time(datetime(2015, 2, 17)),\n", |
185 | 185 | " to_unix_time(datetime(2016, 11, 30))]}),\n",
|
186 |
| - " yaxis=dict(axis, **{'title': '$', 'range':[0,120]}),\n", |
| 186 | + " yaxis=dict(axis, **{'title': '$', 'range':[0,170]}),\n", |
187 | 187 | " updatemenus=[dict(type='buttons',\n",
|
188 | 188 | " showactive=False,\n",
|
189 | 189 | " y=1,\n",
|
|
201 | 201 | "frames=[{'data':[{'xsrc': grid.get_column_reference('x{}'.format(k + 1)),\n",
|
202 | 202 | " 'ysrc': grid.get_column_reference('y{}'.format(k + 1))}],\n",
|
203 | 203 | " 'traces': [0]\n",
|
204 |
| - " } for k in range(len(appl.index) - 1)]\n", |
| 204 | + " } for k in range(len(appl.Date) - 1)]\n", |
205 | 205 | "\n",
|
206 | 206 | "fig=dict(data=data, layout=layout, frames=frames)\n",
|
207 | 207 | "py.icreate_animations(fig, 'AAPL-stockprice' + str(time.time()))"
|
|
218 | 218 | },
|
219 | 219 | {
|
220 | 220 | "cell_type": "code",
|
221 |
| - "execution_count": 5, |
| 221 | + "execution_count": 4, |
222 | 222 | "metadata": {
|
223 | 223 | "collapsed": false
|
224 | 224 | },
|
|
252 | 252 | "output_type": "stream",
|
253 | 253 | "text": [
|
254 | 254 | "Collecting git+https://github.com/plotly/publisher.git\n",
|
255 |
| - " Cloning https://github.com/plotly/publisher.git to /private/var/folders/tc/bs9g6vrd36q74m5t8h9cgphh0000gn/T/pip-19JNWN-build\n", |
| 255 | + " Cloning https://github.com/plotly/publisher.git to /tmp/pip-req-build-obc71o_a\n", |
| 256 | + "Building wheels for collected packages: publisher\n", |
| 257 | + " Running setup.py bdist_wheel for publisher ... \u001b[?25ldone\n", |
| 258 | + "\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-_a4gf6by/wheels/99/3e/a0/fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", |
| 259 | + "Successfully built publisher\n", |
256 | 260 | "Installing collected packages: publisher\n",
|
257 |
| - " Found existing installation: publisher 0.10\n", |
258 |
| - " Uninstalling publisher-0.10:\n", |
259 |
| - " Successfully uninstalled publisher-0.10\n", |
260 |
| - " Running setup.py install for publisher ... \u001b[?25l-\b \bdone\n", |
261 |
| - "\u001b[?25hSuccessfully installed publisher-0.10\n" |
262 |
| - ] |
263 |
| - }, |
264 |
| - { |
265 |
| - "name": "stderr", |
266 |
| - "output_type": "stream", |
267 |
| - "text": [ |
268 |
| - "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/nbconvert.py:13: ShimWarning:\n", |
269 |
| - "\n", |
270 |
| - "The `IPython.nbconvert` package has been deprecated. You should import from nbconvert instead.\n", |
271 |
| - "\n", |
272 |
| - "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/publisher/publisher.py:53: UserWarning:\n", |
273 |
| - "\n", |
274 |
| - "Did you \"Save\" this notebook before running this command? Remember to save, always save.\n", |
275 |
| - "\n" |
| 261 | + " Found existing installation: publisher 0.13\n", |
| 262 | + " Uninstalling publisher-0.13:\n", |
| 263 | + " Successfully uninstalled publisher-0.13\n", |
| 264 | + "Successfully installed publisher-0.13\n", |
| 265 | + "\u001b[33mYou are using pip version 10.0.1, however version 18.1 is available.\n", |
| 266 | + "You should consider upgrading via the 'pip install --upgrade pip' command.\u001b[0m\n" |
276 | 267 | ]
|
277 | 268 | }
|
278 | 269 | ],
|
|
306 | 297 | ],
|
307 | 298 | "metadata": {
|
308 | 299 | "kernelspec": {
|
309 |
| - "display_name": "Python 2", |
| 300 | + "display_name": "Python 3", |
310 | 301 | "language": "python",
|
311 |
| - "name": "python2" |
| 302 | + "name": "python3" |
312 | 303 | },
|
313 | 304 | "language_info": {
|
314 | 305 | "codemirror_mode": {
|
315 | 306 | "name": "ipython",
|
316 |
| - "version": 2 |
| 307 | + "version": 3 |
317 | 308 | },
|
318 | 309 | "file_extension": ".py",
|
319 | 310 | "mimetype": "text/x-python",
|
320 | 311 | "name": "python",
|
321 | 312 | "nbconvert_exporter": "python",
|
322 |
| - "pygments_lexer": "ipython2", |
323 |
| - "version": "2.7.12" |
| 313 | + "pygments_lexer": "ipython3", |
| 314 | + "version": "3.6.5" |
324 | 315 | }
|
325 | 316 | },
|
326 | 317 | "nbformat": 4,
|
327 |
| - "nbformat_minor": 0 |
| 318 | + "nbformat_minor": 2 |
328 | 319 | }
|
0 commit comments