Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "metadata": {
  5. "ExecuteTime": {
  6. "end_time": "2017-07-22T12:42:45.085313Z",
  7. "start_time": "2017-07-22T12:42:45.078092Z"
  8. },
  9. "trusted": true
  10. },
  11. "cell_type": "code",
  12. "source": "%%javascript\nrequire.config({\n paths: {\n d3: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min'\n }\n});",
  13. "execution_count": 1,
  14. "outputs": [
  15. {
  16. "data": {
  17. "application/javascript": "require.config({\n paths: {\n d3: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min'\n }\n});",
  18. "text/plain": "<IPython.core.display.Javascript object>"
  19. },
  20. "metadata": {},
  21. "output_type": "display_data"
  22. }
  23. ]
  24. },
  25. {
  26. "metadata": {
  27. "ExecuteTime": {
  28. "end_time": "2017-07-22T12:42:46.515168Z",
  29. "start_time": "2017-07-22T12:42:46.509591Z"
  30. },
  31. "trusted": true
  32. },
  33. "cell_type": "code",
  34. "source": "%%javascript\nelement.append(\"<div id='chart1'></div>\");",
  35. "execution_count": 2,
  36. "outputs": [
  37. {
  38. "data": {
  39. "application/javascript": "element.append(\"<div id='chart1'></div>\");",
  40. "text/plain": "<IPython.core.display.Javascript object>"
  41. },
  42. "metadata": {},
  43. "output_type": "display_data"
  44. }
  45. ]
  46. },
  47. {
  48. "metadata": {
  49. "ExecuteTime": {
  50. "end_time": "2017-07-22T12:42:55.239817Z",
  51. "start_time": "2017-07-22T12:42:55.224417Z"
  52. },
  53. "trusted": true
  54. },
  55. "cell_type": "code",
  56. "source": "from IPython.display import Javascript\n#runs arbitrary javascript, client-side\nJavascript(\"\"\"\n window.vizObj={};\n \"\"\".format(df.to_json()))",
  57. "execution_count": 3,
  58. "outputs": [
  59. {
  60. "name": "stderr",
  61. "output_type": "stream",
  62. "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"
  63. },
  64. {
  65. "ename": "NameError",
  66. "evalue": "name 'df' is not defined",
  67. "output_type": "error",
  68. "traceback": [
  69. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  70. "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
  71. "\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",
  72. "\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
  73. ]
  74. }
  75. ]
  76. },
  77. {
  78. "metadata": {
  79. "collapsed": true,
  80. "trusted": true
  81. },
  82. "cell_type": "code",
  83. "source": "",
  84. "execution_count": null,
  85. "outputs": []
  86. }
  87. ],
  88. "metadata": {
  89. "gist": {
  90. "id": "",
  91. "data": {
  92. "description": "embedding-d3-in-an-ipython-notebook.ipynb",
  93. "public": true
  94. }
  95. },
  96. "kernelspec": {
  97. "name": "python3",
  98. "display_name": "Python 3",
  99. "language": "python"
  100. },
  101. "toc": {
  102. "threshold": 4,
  103. "number_sections": true,
  104. "toc_cell": false,
  105. "toc_window_display": false,
  106. "toc_section_display": "block",
  107. "sideBar": true,
  108. "navigate_menu": true,
  109. "moveMenuLeft": true,
  110. "widenNotebook": false,
  111. "colors": {
  112. "hover_highlight": "#DAA520",
  113. "selected_highlight": "#FFD700",
  114. "running_highlight": "#FF0000",
  115. "wrapper_background": "#FFFFFF",
  116. "sidebar_border": "#EEEEEE",
  117. "navigate_text": "#333333",
  118. "navigate_num": "#000000"
  119. },
  120. "nav_menu": {
  121. "height": "12px",
  122. "width": "252px"
  123. }
  124. },
  125. "language_info": {
  126. "name": "python",
  127. "version": "3.6.1",
  128. "mimetype": "text/x-python",
  129. "codemirror_mode": {
  130. "name": "ipython",
  131. "version": 3
  132. },
  133. "pygments_lexer": "ipython3",
  134. "nbconvert_exporter": "python",
  135. "file_extension": ".py"
  136. }
  137. },
  138. "nbformat": 4,
  139. "nbformat_minor": 2
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement