Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "metadata": {
- "ExecuteTime": {
- "end_time": "2017-07-22T12:42:45.085313Z",
- "start_time": "2017-07-22T12:42:45.078092Z"
- },
- "trusted": true
- },
- "cell_type": "code",
- "source": "%%javascript\nrequire.config({\n paths: {\n d3: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min'\n }\n});",
- "execution_count": 1,
- "outputs": [
- {
- "data": {
- "application/javascript": "require.config({\n paths: {\n d3: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min'\n }\n});",
- "text/plain": "<IPython.core.display.Javascript object>"
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ]
- },
- {
- "metadata": {
- "ExecuteTime": {
- "end_time": "2017-07-22T12:42:46.515168Z",
- "start_time": "2017-07-22T12:42:46.509591Z"
- },
- "trusted": true
- },
- "cell_type": "code",
- "source": "%%javascript\nelement.append(\"<div id='chart1'></div>\");",
- "execution_count": 2,
- "outputs": [
- {
- "data": {
- "application/javascript": "element.append(\"<div id='chart1'></div>\");",
- "text/plain": "<IPython.core.display.Javascript object>"
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ]
- },
- {
- "metadata": {
- "ExecuteTime": {
- "end_time": "2017-07-22T12:42:55.239817Z",
- "start_time": "2017-07-22T12:42:55.224417Z"
- },
- "trusted": true
- },
- "cell_type": "code",
- "source": "from IPython.display import Javascript\n#runs arbitrary javascript, client-side\nJavascript(\"\"\"\n window.vizObj={};\n \"\"\".format(df.to_json()))",
- "execution_count": 3,
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": "ERROR:root:An unexpected error occurred while tokenizing input\nThe following traceback may be corrupted or invalid\nThe error message is: ('EOF in multi-line string', (1, 11))\n\n"
- },
- {
- "ename": "NameError",
- "evalue": "name 'df' is not defined",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m<ipython-input-3-c6556b3ba378>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m Javascript(\"\"\"\n\u001b[1;32m 4\u001b[0m \u001b[0mwindow\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvizObj\u001b[0m\u001b[0;34m=\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[0;32m----> 5\u001b[0;31m \"\"\".format(df.to_json()))\n\u001b[0m",
- "\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
- ]
- }
- ]
- },
- {
- "metadata": {
- "collapsed": true,
- "trusted": true
- },
- "cell_type": "code",
- "source": "",
- "execution_count": null,
- "outputs": []
- }
- ],
- "metadata": {
- "gist": {
- "id": "",
- "data": {
- "description": "embedding-d3-in-an-ipython-notebook.ipynb",
- "public": true
- }
- },
- "kernelspec": {
- "name": "python3",
- "display_name": "Python 3",
- "language": "python"
- },
- "toc": {
- "threshold": 4,
- "number_sections": true,
- "toc_cell": false,
- "toc_window_display": false,
- "toc_section_display": "block",
- "sideBar": true,
- "navigate_menu": true,
- "moveMenuLeft": true,
- "widenNotebook": false,
- "colors": {
- "hover_highlight": "#DAA520",
- "selected_highlight": "#FFD700",
- "running_highlight": "#FF0000",
- "wrapper_background": "#FFFFFF",
- "sidebar_border": "#EEEEEE",
- "navigate_text": "#333333",
- "navigate_num": "#000000"
- },
- "nav_menu": {
- "height": "12px",
- "width": "252px"
- }
- },
- "language_info": {
- "name": "python",
- "version": "3.6.1",
- "mimetype": "text/x-python",
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "pygments_lexer": "ipython3",
- "nbconvert_exporter": "python",
- "file_extension": ".py"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement