-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jupyter Notebook.html
162 lines (155 loc) · 78.7 KB
/
Jupyter Notebook.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- common.css -->
<style>* {-webkit-tap-highlight-color: rgba(0,0,0,0);}html {-webkit-text-size-adjust: none;}body {font-family: -apple-system, Helvetica, Arial, sans-serif;margin: 0;padding: 20px;color: #333;word-wrap: break-word;}h1, h2, h3, h4, h5, h6 {line-height: 1.1;}img {max-width: 100% !important;height: auto;}blockquote {margin: 0;padding: 0 15px;color: #777;border-left: 4px solid #ddd;}hr {background-color: #ddd;border: 0;height: 1px;margin: 15px 0;}code {font-family: Menlo, Consolas, 'Ubuntu Mono', Monaco, 'source-code-pro', monospace;line-height: 1.4;margin: 0;padding: 0.2em 0;font-size: 90%;background-color: rgba(0,0,0,0.04);border-radius: 3px;}pre > code {margin: 0;padding: 0;font-size: 100%;word-break: normal;background: transparent;border: 0;}ol {list-style-type: decimal;}ol ol, ul ol {list-style-type: lower-latin;}ol ol ol, ul ol ol, ul ul ol, ol ul ol {list-style-type: lower-roman;}table {border-spacing: 0;border-collapse: collapse;margin-top: 0;margin-bottom: 16px;}table th {font-weight: bold;}table th, table td {padding: 6px 13px;border: 1px solid #ddd;}table tr {border-top: 1px solid #ccc;}table tr:nth-child(even) {background-color: #f8f8f8;}input[type="checkbox"] {cursor: default;margin-right: 0.5em;font-size: 13px;}.task-list-item {list-style-type: none;}.task-list-item+.task-list-item {margin-top: 3px;}.task-list-item input {float: left;margin: 0.3em 1em 0.25em -1.6em;vertical-align: middle;}#tag-field {margin: 8px 2px 10px;}#tag-field .tag {display: inline-block;background: #cadff3;border-radius: 4px;padding: 1px 8px;color: black;font-size: 12px;margin-right: 10px;line-height: 1.4;}</style>
<!-- ace-static.css -->
<style>.ace_static_highlight {white-space: pre-wrap;}.ace_static_highlight .ace_gutter {width: 2em;text-align: right;padding: 0 3px 0 0;margin-right: 3px;}.ace_static_highlight.ace_show_gutter > .ace_line {padding-left: 2.6em;}.ace_static_highlight .ace_line {position: relative;}.ace_static_highlight .ace_gutter-cell {-moz-user-select: -moz-none;-khtml-user-select: none;-webkit-user-select: none;user-select: none;top: 0;bottom: 0;left: 0;position: absolute;}.ace_static_highlight .ace_gutter-cell:before {content: counter(ace_line, decimal);counter-increment: ace_line;}.ace_static_highlight {counter-reset: ace_line;}</style>
<style>.ace-chrome .ace_gutter {background: #ebebeb;color: #333;overflow : hidden;}.ace-chrome .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-chrome {background-color: #FFFFFF;color: black;}.ace-chrome .ace_cursor {color: black;}.ace-chrome .ace_invisible {color: rgb(191, 191, 191);}.ace-chrome .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-chrome .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-chrome .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-chrome .ace_invalid {background-color: rgb(153, 0, 0);color: white;}.ace-chrome .ace_fold {}.ace-chrome .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-chrome .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-chrome .ace_support.ace_type,.ace-chrome .ace_support.ace_class.ace-chrome .ace_support.ace_other {color: rgb(109, 121, 222);}.ace-chrome .ace_variable.ace_parameter {font-style:italic;color:#FD971F;}.ace-chrome .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-chrome .ace_comment {color: #236e24;}.ace-chrome .ace_comment.ace_doc {color: #236e24;}.ace-chrome .ace_comment.ace_doc.ace_tag {color: #236e24;}.ace-chrome .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-chrome .ace_variable {color: rgb(49, 132, 149);}.ace-chrome .ace_xml-pe {color: rgb(104, 104, 91);}.ace-chrome .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-chrome .ace_heading {color: rgb(12, 7, 255);}.ace-chrome .ace_list {color:rgb(185, 6, 144);}.ace-chrome .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-chrome .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-chrome .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-chrome .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-chrome .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-chrome .ace_gutter-active-line {background-color : #dcdcdc;}.ace-chrome .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-chrome .ace_storage,.ace-chrome .ace_keyword,.ace-chrome .ace_meta.ace_tag {color: rgb(147, 15, 128);}.ace-chrome .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-chrome .ace_string {color: #1A1AA6;}.ace-chrome .ace_entity.ace_other.ace_attribute-name {color: #994409;}.ace-chrome .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}</style>
<!-- export.css -->
<style>
body{margin:0 auto;max-width:800px;line-height:1.4}
#nav{margin:5px 0 10px;font-size:15px}
#titlearea{border-bottom:1px solid #ccc;font-size:17px;padding:10px 0;}
#contentarea{font-size:15px;margin:16px 0}
.cell{outline:0;min-height:20px;margin:5px 0;padding:5px 0;}
.code-cell{font-family:Menlo,Consolas,'Ubuntu Mono',Monaco,'source-code-pro',monospace;font-size:12px;}
.latex-cell{white-space:pre-wrap;}
</style>
<!-- User CSS -->
<style> .text-cell {font-size: 15px;}.code-cell {font-size: 12px;}.markdown-cell {font-size: 15px;}.latex-cell {font-size: 15px;}</style>
</head>
<body>
<div id="nav"><div>Next: <a href='Pandas.html'>Pandas</a>, Previous: <a href='MySQL.html'>MySQL</a>, Up: <a href='index.html'>Index</a></div></div>
<div id="titlearea">
<h2>Jupyter Notebook</h2>
</div>
<div id="contentarea"><div class="cell text-cell"><br></div><div class="cell text-cell"></div><div class="cell text-cell"><div>from IPython.core.interactiveshell import InteractiveShell</div><div>InteractiveShell.ast_node_interactivity = "all"</div></div><div class="cell text-cell"><h1 style="box-sizing: border-box; margin: 20px 0px 10px; font-size: 36px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 500; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">Use Jupyter notebook remotely</h1><p style="box-sizing: border-box; margin: 0px 0px 10px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">try <code class="docutils literal" style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(49, 130, 189); background-color: white; border-radius: 4px;"><span class="pre" style="box-sizing: border-box; hyphens: none;">pytraj</span></code> online:</p><span style="font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"></span><p style="box-sizing: border-box; margin: 0px 0px 10px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><span style="box-sizing: border-box; font-weight: 700;">Situation</span>: Your data (may be TB) is in your working cluster. You want to access and interactively play with your datayour home computer. You can use xwin to open your Jupyter notebook on remote host. However, this kind of connection is quite slow.</p><p style="box-sizing: border-box; margin: 0px 0px 10px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">To make the connection faster, you can follow below instructions:</p><ul style="box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><li style="box-sizing: border-box;"><p class="first" style="box-sizing: border-box; margin-top: 0px !important; margin-right: 0px; margin-bottom: 10px; margin-left: 0px;">First, make sure you install Jupyter notebook in both remote (working station in your offcie) and local (your home computer)</p></li><li style="box-sizing: border-box;"><p class="first" style="box-sizing: border-box; margin-top: 0px !important; margin-right: 0px; margin-bottom: 10px; margin-left: 0px;">In remote host, open the terminal, change directory to where you have your notebooks and type:</p><div class="highlight-default" style="box-sizing: border-box;"><div class="highlight" style="box-sizing: border-box; background: none; border-left: 2px solid rgb(53, 169, 222);"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px;"><span style="box-sizing: border-box;"></span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);"><span class="pln" style="font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; white-space: inherit; background-color: rgb(239, 240, 241); margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">jupyter notebook </span><span class="pun" style="font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; white-space: inherit; background-color: rgb(239, 240, 241); margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">--</span><span class="typ" style="font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; white-space: inherit; background-color: rgb(239, 240, 241); margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(43, 145, 175);">NotebookApp</span><span class="pun" style="font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; white-space: inherit; background-color: rgb(239, 240, 241); margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">.</span><span class="pln" style="font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; white-space: inherit; background-color: rgb(239, 240, 241); margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">iopub_data_rate_limit</span><span class="pun" style="font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; white-space: inherit; background-color: rgb(239, 240, 241); margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(48, 51, 54);">=</span><span class="lit" style="font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; white-space: inherit; background-color: rgb(239, 240, 241); margin: 0px; padding: 0px; border: 0px; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(125, 39, 39);">2147483647 </span>--</span><span class="n" style="box-sizing: border-box;">no</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">-</span><span class="n" style="box-sizing: border-box;">browser</span> <span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">--</span><span class="n" style="box-sizing: border-box;">port</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="mi" style="box-sizing: border-box; color: rgb(32, 128, 80);">8889</span>
<span class="c1" style="box-sizing: border-box; color: rgb(64, 128, 144); font-style: italic;"># you should leave the this open</span>
</pre></div></div></li><li style="box-sizing: border-box;"><p class="first" style="box-sizing: border-box; margin-top: 0px !important; margin-right: 0px; margin-bottom: 10px; margin-left: 0px;">In your local computer, open MS-DOS cmd (if using Windows) or Unix terminal, then type:</p><div class="highlight-default" style="box-sizing: border-box;"><div class="highlight" style="box-sizing: border-box; background: none; border-left: 2px solid rgb(53, 169, 222);"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">ssh</span> <span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">-</span><span class="n" style="box-sizing: border-box;">N</span> <span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">-</span><span class="n" style="box-sizing: border-box;">f</span> <span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">-</span><span class="n" style="box-sizing: border-box;">L</span> <span class="n" style="box-sizing: border-box;">localhost</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: rgb(32, 128, 80);">8888</span><span class="p" style="box-sizing: border-box;">: </span><span class="n" style="box-sizing: border-box;">localhost</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: rgb(32, 128, 80);">8889</span> congyang<span class="nd" style="box-sizing: border-box; color: rgb(85, 85, 85); font-weight: bold;">@urban.cs.wpi.edu</span>
<span class="c1" style="box-sizing: border-box; color: rgb(64, 128, 144); font-style: italic;"># make sure to change `username` to your real username in remote host</span>
<span class="c1" style="box-sizing: border-box; color: rgb(64, 128, 144); font-style: italic;"># change `your_remote_host_name` to your address of your working station</span>
<span class="c1" style="box-sizing: border-box; color: rgb(64, 128, 144); font-style: italic;"># Example: ssh -N -f -L localhost:8888:localhost:8889 [email protected]</span>
</pre></div></div></li><li style="box-sizing: border-box;"><p class="first" style="box-sizing: border-box; margin-top: 0px !important; margin-right: 0px; margin-bottom: 10px; margin-left: 0px;">Now open web browser (google chrome, firefox, ...) and type:</p><div class="highlight-default" style="box-sizing: border-box;"><div class="highlight" style="box-sizing: border-box; background: none; border-left: 2px solid rgb(53, 169, 222);"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">localhost</span><span class="p" style="box-sizing: border-box;">:</span><span class="mi" style="box-sizing: border-box; color: rgb(32, 128, 80);">8888</span>
<span class="c1" style="box-sizing: border-box; color: rgb(64, 128, 144); font-style: italic;"># you will see your notebooks in your given directory</span></pre><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px;"><span class="c1" style="box-sizing: border-box; color: rgb(64, 128, 144); font-style: italic;"><p style="margin-top: 0px; margin-bottom: 1rem; color: rgb(17, 17, 17); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; white-space: normal; background-color: rgb(255, 255, 255);">which displays your remotely running IPython notebook server.</p><hr style="margin-bottom: 1rem; height: 2px; background-color: rgba(0, 0, 0, 0.121569); color: rgb(17, 17, 17); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; white-space: normal;"><p style="margin-top: 0px; margin-bottom: 1rem; color: rgb(17, 17, 17); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; white-space: normal; background-color: rgb(255, 255, 255);">To close the SSH tunnel on the local machine, look for the process and kill it manually:</p><pre style="font-family: Monaco, Consolas, monospace; font-size: 16px; margin: 0px -1rem 1rem; overflow-x: scroll; background-color: rgba(250, 250, 250, 0.701961); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; padding: 1rem; color: rgb(17, 17, 17); font-style: normal; font-variant-ligatures: normal;"><code class="prettyprint prettyprinted" style="font-family: Monaco, Consolas, monospace; font-size: 13px;"><span class="pln" style="color: rgb(0, 0, 0);">local_user@local_host$ ps aux </span><span class="pun" style="color: rgb(102, 102, 0);">|</span><span class="pln" style="color: rgb(0, 0, 0);"> grep localhost</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="lit" style="color: rgb(0, 102, 102);">8889</span><span class="pln" style="color: rgb(0, 0, 0);">
local_user </span><span class="lit" style="color: rgb(0, 102, 102);">18418</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">0.0</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">0.0</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">41488</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">684</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="pun" style="color: rgb(102, 102, 0);">?</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="typ" style="color: rgb(102, 0, 102);">Ss</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">17</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="lit" style="color: rgb(0, 102, 102);">27</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">0</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="lit" style="color: rgb(0, 102, 102);">00</span><span class="pln" style="color: rgb(0, 0, 0);"> ssh </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="pln" style="color: rgb(0, 0, 0);">N </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="pln" style="color: rgb(0, 0, 0);">f </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="pln" style="color: rgb(0, 0, 0);">L localhost</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="lit" style="color: rgb(0, 102, 102);">8888</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="pln" style="color: rgb(0, 0, 0);">localhost</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="lit" style="color: rgb(0, 102, 102);">8889</span><span class="pln" style="color: rgb(0, 0, 0);"> remote_user@remote_host
local_user </span><span class="lit" style="color: rgb(0, 102, 102);">18424</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">0.0</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">0.0</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">11572</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">932</span><span class="pln" style="color: rgb(0, 0, 0);"> pts</span><span class="pun" style="color: rgb(102, 102, 0);">/</span><span class="lit" style="color: rgb(0, 102, 102);">6</span><span class="pln" style="color: rgb(0, 0, 0);"> S</span><span class="pun" style="color: rgb(102, 102, 0);">+</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">17</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="lit" style="color: rgb(0, 102, 102);">27</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">0</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="lit" style="color: rgb(0, 102, 102);">00</span><span class="pln" style="color: rgb(0, 0, 0);"> grep localhost</span><span class="pun" style="color: rgb(102, 102, 0);">:</span><span class="lit" style="color: rgb(0, 102, 102);">8889</span><span class="pln" style="color: rgb(0, 0, 0);">
local_user@local_host$ kill </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="lit" style="color: rgb(0, 102, 102);">15</span><span class="pln" style="color: rgb(0, 0, 0);"> </span><span class="lit" style="color: rgb(0, 102, 102);">18418</span></code></pre><p style="margin-top: 0px; margin-bottom: 1rem; color: rgb(17, 17, 17); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; white-space: normal; background-color: rgb(255, 255, 255);">Alternatively, you can start the tunnel without the -f option. The process will then remain in the foreground and can be killed with ctrl-c.</p><p style="margin-top: 0px; margin-bottom: 0px; color: rgb(17, 17, 17); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; white-space: normal; background-color: rgb(255, 255, 255);">On the remote machine, kill the IPython server with ctrl-c ctrl-c.</p></span></pre><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px;"><span class="c1" style="box-sizing: border-box; color: rgb(64, 128, 144); font-style: italic;"><br></span></pre></div></div></li></ul></div><div class="cell text-cell"><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-ligatures: normal; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41); orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">This worked for me on Ubuntu 16.04:</p><pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-variant-ligatures: normal; font-variant-numeric: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41); orphans: 2; widows: 2;"><code style="font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: inherit;">python2 -m pip install ipykernel
python2 -m ipykernel install --user
python3 -m pip install ipykernel
python3 -m ipykernel install --user
</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-ligatures: normal; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41); orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">Reference to the documentation:<br><a href="https://ipython.readthedocs.io/en/latest/install/kernel_install.html#kernels-for-python-2-and-3" rel="noreferrer" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;">Kernels for Python 2 and 3</a>. Installing the IPython kernel - IPython Docs.</p></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"><div class="cell border-box-sizing text_cell rendered" style="box-sizing: border-box; -webkit-box-orient: horizontal; -webkit-box-align: stretch; display: flex; flex-direction: row; align-items: stretch; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border: 1px solid transparent; width: 697.5px; padding-right: 5px; padding-left: 5px; margin-top: 0px; margin-bottom: 0px; background-image: linear-gradient(to right, transparent -40px, transparent 1px, transparent 1px, transparent 100%); background-color: rgb(255, 255, 255); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-position: initial initial; background-repeat: initial initial;"><div class="inner_cell" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; -webkit-box-flex: 1; flex: 1 1 0%;"><div class="text_cell_render border-box-sizing rendered_html" style="box-sizing: border-box; color: rgb(0, 0, 0); outline: none; resize: none; width: inherit; border-style: none; padding: 0.5em 0.5em 0.5em 0.4em;"><h3 id="2.-Pretty-Display-of-Varibles" style="box-sizing: border-box; font-family: inherit; font-weight: 500; color: inherit; margin-top: 0.777em; margin-bottom: 10px; font-size: 24px;">2. Pretty Display of Varibles<a class="anchor-link" href="http://liuchengxu.org/pelican-blog/jupyter-notebook-tips.html#2.-Pretty-Display-of-Varibles" style="box-sizing: border-box; background-color: transparent; color: inherit; text-decoration: none; border-bottom: 1px dotted; padding: 0px 20px; visibility: hidden;"></a></h3><p style="box-sizing: border-box; margin: 1em 0px 10px;">这部分内容可能很多人都知道。如果对带有一个变量或是未赋值语句的cell执行操作,Jupyter 将会自动打印该变量而无需一个输出语句。这非常有用,尤其是使用 Pandas DataFrames 进行处理时,因为输出将会被整齐地格式化为一个表格。</p><p style="box-sizing: border-box; margin: 1em 0px 10px;">接下来的内容可能没那么人知道:你可以选择修改 <code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">ast_note_iteractively</code> kernal 选项来使得 Jupyter 为每一行的变量或语句执行这个操作,以便你可以立即看到多条语句一起输出。</p></div></div></div><div class="cell border-box-sizing code_cell rendered" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border: 1px solid transparent; width: 697.5px; padding-right: 5px; padding-left: 5px; margin-top: 0px; margin-bottom: 0px; background-image: linear-gradient(to right, transparent -40px, transparent 1px, transparent 1px, transparent 100%); background-color: rgb(255, 255, 255); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-position: initial initial; background-repeat: initial initial;"><div class="input" style="box-sizing: border-box; break-inside: avoid; -webkit-box-orient: horizontal; -webkit-box-align: stretch; display: flex; flex-direction: row; align-items: stretch;"><div class="prompt input_prompt" style="box-sizing: border-box; min-width: 14ex; padding: 0.4em; margin: 0px; font-family: monospace; text-align: right; line-height: 1.21429em; user-select: none; cursor: default; color: rgb(48, 63, 159); border-top: 1px solid transparent;">In [17]:</div><div class="inner_cell" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; -webkit-box-flex: 1; flex: 1 1 0%;"><div class="input_area" style="box-sizing: border-box; border: 1px solid rgb(207, 207, 207); border-radius: 2px; background: rgb(247, 247, 247); line-height: 1.21429em;"><div class=" highlight hl-ipython3" style="box-sizing: border-box; background: transparent; margin: 0.4em; border: none; padding: 0px;"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 0px; margin-top: 0px; margin-bottom: 0px; line-height: 1.42857; color: rgb(68, 85, 102); word-break: break-all; word-wrap: break-word; background-color: transparent; border: none; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-position: initial initial; background-repeat: initial initial;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">line1</span> <span class="o" style="box-sizing: border-box; color: rgb(51, 68, 85);">=</span> <span class="s2" style="box-sizing: border-box; color: rgb(237, 157, 19);">"this is from line 1"</span>
<span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">line2</span> <span class="o" style="box-sizing: border-box; color: rgb(51, 68, 85);">=</span> <span class="s2" style="box-sizing: border-box; color: rgb(237, 157, 19);">"this is from line 2"</span>
<span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">line1</span>
<span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">line2</span>
</pre></div></div></div></div><div class="output_wrapper" style="box-sizing: border-box; position: relative; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; z-index: 1;"><div class="output" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch;"><div class="output_area" style="box-sizing: border-box; padding: 0px; break-inside: avoid; -webkit-box-orient: horizontal; -webkit-box-align: stretch; display: flex; flex-direction: row; align-items: stretch;"><div class="prompt output_prompt" style="box-sizing: border-box; min-width: 14ex; padding: 0.4em; margin: 0px; font-family: monospace; text-align: right; line-height: 1.21429em; user-select: none; cursor: default; color: rgb(216, 67, 21);">Out[17]:</div><div class="output_text output_subarea output_execute_result" style="box-sizing: border-box; overflow-x: auto; padding: 0.4em; -webkit-box-flex: 1; flex: 1 1 0%; max-width: calc(100% - 14ex); color: rgb(0, 0, 0); line-height: 1.21429em;"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 0px; margin-top: 0px; margin-bottom: 0px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; background-color: transparent; border: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; vertical-align: baseline;">'this is from line 2'</pre></div></div></div></div></div><div class="cell border-box-sizing code_cell rendered" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border: 1px solid transparent; width: 697.5px; padding-right: 5px; padding-left: 5px; margin-top: 0px; margin-bottom: 0px; background-image: linear-gradient(to right, transparent -40px, transparent 1px, transparent 1px, transparent 100%); background-color: rgb(255, 255, 255); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-position: initial initial; background-repeat: initial initial;"><div class="input" style="box-sizing: border-box; break-inside: avoid; -webkit-box-orient: horizontal; -webkit-box-align: stretch; display: flex; flex-direction: row; align-items: stretch;"><div class="prompt input_prompt" style="box-sizing: border-box; min-width: 14ex; padding: 0.4em; margin: 0px; font-family: monospace; text-align: right; line-height: 1.21429em; user-select: none; cursor: default; color: rgb(48, 63, 159); border-top: 1px solid transparent;">In [18]:</div><div class="inner_cell" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; -webkit-box-flex: 1; flex: 1 1 0%;"><div class="input_area" style="box-sizing: border-box; border: 1px solid rgb(207, 207, 207); border-radius: 2px; background: rgb(247, 247, 247); line-height: 1.21429em;"><div class=" highlight hl-ipython3" style="box-sizing: border-box; background: transparent; margin: 0.4em; border: none; padding: 0px;"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 0px; margin-top: 0px; margin-bottom: 0px; line-height: 1.42857; color: rgb(68, 85, 102); word-break: break-all; word-wrap: break-word; background-color: transparent; border: none; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-position: initial initial; background-repeat: initial initial;"><span style="box-sizing: border-box;"></span><span class="kn" style="box-sizing: border-box; color: rgb(106, 184, 37); font-weight: bold;">from</span> <span class="nn" style="box-sizing: border-box; color: rgb(68, 127, 207); font-weight: bold; text-decoration: underline;">IPython.core.interactiveshell</span> <span class="k" style="box-sizing: border-box; color: rgb(106, 184, 37); font-weight: bold;">import</span> <span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">InteractiveShell</span>
<span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">InteractiveShell</span><span class="o" style="box-sizing: border-box; color: rgb(51, 68, 85);">.</span><span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">ast_node_interactivity</span> <span class="o" style="box-sizing: border-box; color: rgb(51, 68, 85);">=</span> <span class="s2" style="box-sizing: border-box; color: rgb(237, 157, 19);">"all"</span>
</pre></div></div></div></div></div><div class="cell border-box-sizing code_cell rendered" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border: 1px solid transparent; width: 697.5px; padding-right: 5px; padding-left: 5px; margin-top: 0px; margin-bottom: 0px; background-image: linear-gradient(to right, transparent -40px, transparent 1px, transparent 1px, transparent 100%); background-color: rgb(255, 255, 255); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-position: initial initial; background-repeat: initial initial;"><div class="input" style="box-sizing: border-box; break-inside: avoid; -webkit-box-orient: horizontal; -webkit-box-align: stretch; display: flex; flex-direction: row; align-items: stretch;"><div class="prompt input_prompt" style="box-sizing: border-box; min-width: 14ex; padding: 0.4em; margin: 0px; font-family: monospace; text-align: right; line-height: 1.21429em; user-select: none; cursor: default; color: rgb(48, 63, 159); border-top: 1px solid transparent;">In [19]:</div><div class="inner_cell" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; -webkit-box-flex: 1; flex: 1 1 0%;"><div class="input_area" style="box-sizing: border-box; border: 1px solid rgb(207, 207, 207); border-radius: 2px; background: rgb(247, 247, 247); line-height: 1.21429em;"><div class=" highlight hl-ipython3" style="box-sizing: border-box; background: transparent; margin: 0.4em; border: none; padding: 0px;"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 0px; margin-top: 0px; margin-bottom: 0px; line-height: 1.42857; color: rgb(68, 85, 102); word-break: break-all; word-wrap: break-word; background-color: transparent; border: none; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-position: initial initial; background-repeat: initial initial;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">line1</span>
<span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">line2</span>
</pre></div></div></div></div><div class="output_wrapper" style="box-sizing: border-box; position: relative; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; z-index: 1;"><div class="output" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch;"><div class="output_area" style="box-sizing: border-box; padding: 0px; break-inside: avoid; -webkit-box-orient: horizontal; -webkit-box-align: stretch; display: flex; flex-direction: row; align-items: stretch;"><div class="prompt output_prompt" style="box-sizing: border-box; min-width: 14ex; padding: 0.4em; margin: 0px; font-family: monospace; text-align: right; line-height: 1.21429em; user-select: none; cursor: default; color: rgb(216, 67, 21);">Out[19]:</div><div class="output_text output_subarea output_execute_result" style="box-sizing: border-box; overflow-x: auto; padding: 0.4em; -webkit-box-flex: 1; flex: 1 1 0%; max-width: calc(100% - 14ex); color: rgb(0, 0, 0); line-height: 1.21429em;"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 0px; margin-top: 0px; margin-bottom: 0px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; background-color: transparent; border: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; vertical-align: baseline;">'this is from line 1'</pre></div></div><div class="output_area" style="box-sizing: border-box; padding: 0px; break-inside: avoid; -webkit-box-orient: horizontal; -webkit-box-align: stretch; display: flex; flex-direction: row; align-items: stretch;"><div class="prompt output_prompt" style="box-sizing: border-box; min-width: 14ex; padding: 0.4em; margin: 0px; font-family: monospace; text-align: right; line-height: 1.21429em; user-select: none; cursor: default; color: rgb(216, 67, 21);">Out[19]:</div><div class="output_text output_subarea output_execute_result" style="box-sizing: border-box; overflow-x: auto; padding: 0.4em; -webkit-box-flex: 1; flex: 1 1 0%; max-width: calc(100% - 14ex); color: rgb(0, 0, 0); line-height: 1.21429em;"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 0px; margin-top: 0px; margin-bottom: 0px; line-height: 1.42857; word-break: break-all; word-wrap: break-word; background-color: transparent; border: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; vertical-align: baseline;">'this is from line 2'</pre></div></div></div></div></div><div class="cell border-box-sizing text_cell rendered" style="box-sizing: border-box; -webkit-box-orient: horizontal; -webkit-box-align: stretch; display: flex; flex-direction: row; align-items: stretch; border-top-left-radius: 2px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; border: 1px solid transparent; width: 697.5px; padding-right: 5px; padding-left: 5px; margin-top: 0px; margin-bottom: 0px; background-image: linear-gradient(to right, transparent -40px, transparent 1px, transparent 1px, transparent 100%); background-color: rgb(255, 255, 255); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-position: initial initial; background-repeat: initial initial;"><div class="prompt input_prompt" style="box-sizing: border-box; min-width: 14ex; padding: 0.4em; margin: 0px; font-family: monospace; text-align: right; line-height: 1.21429em; user-select: none; cursor: default; color: rgb(48, 63, 159); border-top: 1px solid transparent;"></div><div class="inner_cell" style="box-sizing: border-box; -webkit-box-orient: vertical; -webkit-box-align: stretch; display: flex; flex-direction: column; align-items: stretch; -webkit-box-flex: 1; flex: 1 1 0%;"><div class="text_cell_render border-box-sizing rendered_html" style="box-sizing: border-box; color: rgb(0, 0, 0); outline: none; resize: none; width: inherit; border-style: none; padding: 0.5em 0.5em 0.5em 0.4em;"><p style="box-sizing: border-box; margin: 0px 0px 10px;">如果你想要所有的Jupyter实例(Notebook和Console)都设置该选项,只需创建 <code style="box-sizing: border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;">~/.ipython/profile_default/ipython_config.py</code> 文件并写入一下内容:</p><div class="highlight" style="box-sizing: border-box; background: rgb(248, 248, 248);"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 9.5px; margin-top: 1em; margin-bottom: 10px; line-height: 1.42857; color: rgb(68, 85, 102); word-break: break-all; word-wrap: break-word; background-color: rgb(253, 246, 227); border: 1px solid rgb(204, 204, 204); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-position: initial initial; background-repeat: initial initial;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">c</span> <span class="o" style="box-sizing: border-box; color: rgb(51, 68, 85);">=</span> <span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">get_config</span><span class="p" style="box-sizing: border-box; color: rgb(51, 68, 85);">()</span>
<span class="c1" style="box-sizing: border-box; color: rgb(153, 153, 153); font-style: italic;"># Run all nodes interactively</span>
<span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">c</span><span class="o" style="box-sizing: border-box; color: rgb(51, 68, 85);">.</span><span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">InteractiveShell</span><span class="o" style="box-sizing: border-box; color: rgb(51, 68, 85);">.</span><span class="n" style="box-sizing: border-box; color: rgb(51, 68, 85);">ast_node_interactivity</span> <span class="o" style="box-sizing: border-box; color: rgb(51, 68, 85);">=</span> <span class="s2" style="box-sizing: border-box; color: rgb(237, 157, 19);">"all"</span></pre></div></div></div></div><p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"></p></div><div class="cell text-cell"><h3 style="box-sizing: border-box; font-family: Roboto, sans-serif; font-weight: 500; color: rgb(66, 66, 66); margin-top: 20px; margin-bottom: 10px; font-size: 18px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">Drop duplicates in the first name column, but take the last obs in the duplicated set</h3><div class="codehilite" style="box-sizing: border-box; color: rgb(66, 66, 66); font-family: Roboto, sans-serif; font-size: 16px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; overflow: auto; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857; color: rgb(51, 51, 51); word-break: break-all; word-wrap: break-word; background-color: rgb(251, 251, 251); border: 1px solid rgb(222, 222, 222); border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;"><span style="box-sizing: border-box;"></span><span class="n" style="box-sizing: border-box;">df</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">.</span><span class="n" style="box-sizing: border-box;">drop_duplicates</span><span class="p" style="box-sizing: border-box;">([</span><span class="s1" style="box-sizing: border-box; color: rgb(186, 33, 33);">'first_name'</span><span class="p" style="box-sizing: border-box;">],</span> <span class="n" style="box-sizing: border-box;">keep</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="s1" style="box-sizing: border-box; color: rgb(186, 33, 33);">'last'</span><span class="p" style="box-sizing: border-box;">)</span></pre></div></div><div class="cell code-cell"><div class="ace-chrome"><div class="ace_static_highlight ace_show_gutter" style="counter-reset:ace_line 0"><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_identifier">Tips</span><span class="ace_keyword ace_operator">-</span><span class="ace_identifier">Jupyter</span> <span class="ace_identifier">Notebook</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_keyword">from</span> <span class="ace_identifier">IPython</span>.<span class="ace_identifier">display</span> <span class="ace_keyword">import</span> <span class="ace_identifier">display</span> <span class="ace_comment"># for the multiple output</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_keyword">import</span> <span class="ace_identifier">pandas</span> <span class="ace_keyword">as</span> <span class="ace_identifier">pd</span> <span class="ace_comment"># for data reading and pre-processing</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_keyword">import</span> <span class="ace_identifier">numpy</span> <span class="ace_keyword">as</span> <span class="ace_identifier">np</span> <span class="ace_comment"># for the model building</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_keyword">import</span> <span class="ace_identifier">matplotlib</span>.<span class="ace_identifier">pyplot</span> <span class="ace_keyword">as</span> <span class="ace_identifier">plt</span> <span class="ace_comment"># for the visualization</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_keyword">import</span> <span class="ace_identifier">seaborn</span> <span class="ace_keyword">as</span> <span class="ace_identifier">sns</span> <span class="ace_comment"># for the visualization</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_keyword ace_operator">%</span><span class="ace_identifier">matplotlib</span> <span class="ace_identifier">inline</span>
</div></div></div></div><div class="cell text-cell"><p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><span style="text-decoration: underline"></span></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><span style="text-decoration: underline"></span><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">编辑模式下按</span> control + shift + - <span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">可拆分</span>cell </p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><span style="text-decoration: underline"></span><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);"><span style="text-decoration: underline"><a href="https://www.zybuluo.com/hanxiaoyang/note/534296">Jupyter Notebook<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC"; color: rgb(228, 175, 10);">的</span><span style="color: rgb(228, 175, 10);">27</span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC"; color: rgb(228, 175, 10);">个秘诀,技巧和快捷键</span><span style="color: rgb(228, 175, 10);"> - </span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC"; color: rgb(228, 175, 10);">作业部落</span><span style="color: rgb(228, 175, 10);"> Cmd Markdown </span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC"; color: rgb(228, 175, 10);">编辑阅读器</span></a></span></p>
<p style="margin: 0px 0px 2px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 17px;"><b></b><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);"><span style="text-decoration: underline"><a href="https://github.com/jupyter/jupyter/issues/71">Question: how to install Python 2.7 as an additional kernel next to the default Python 3.X one? · Issue #71 · jupyter/jupyter<span style="color: rgb(228, 175, 10);"></span></a></span></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><img src="resources/CDBB1A1B81623547029A3D247EE16FDC.jpg" alt="Pasted Graphic.tiff" width="767" height="282"></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><img src="resources/CD8860B50D70E04884881DCA5C8A8238.jpg" alt="Pasted Graphic_1.tiff" width="1399" height="366"></p>
<p style="margin: 0px 0px 2px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: ".PingFang SC"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";"><b>26</b></span>、大数据分析</p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: ".PingFang SC"; color: rgb(69, 69, 69);">很多方案可以解决查询<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">/</span>处理大数据的问题:</p>
<ul>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;"><a href="https://github.com/ipython/ipyparallel"><span style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);">ipyparallel</span></a></span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">(之前叫</span> ipython cluster<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">)</span> <span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">是一个在</span>python<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">中进行简单的</span>map-reduce<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">运算的良好选择。我们在</span>rep<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">中使用它来并行训练很多机器学习模型。</span></li>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(69, 69, 69);"><a href="http://www.cloudera.com/documentation/enterprise/5-5-x/topics/spark_ipython.html"><span style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);">pyspark</span></a></span></li>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(69, 69, 69);"><a href="https://github.com/jupyter-incubator/sparkmagic"><span style="font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);">spark-sql magic</span></a></span><span style="color: #454545"> %%sql</span></li>
</ul>
<p style="margin: 0px 0px 2px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 17px;"><b></b><br></p>
<p style="margin: 0px 0px 2px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><b>27</b><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">、分享</span>notebook</p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: ".PingFang SC"; color: rgb(69, 69, 69);">分享<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">notebook</span>最方便的方法是使用<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">notebook</span>文件(<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">.ipynb</span>),但是对那些不使用<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">notebook</span>的人,你还有这些选择:</p>
<ul>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;"></span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">通过</span>File > Download as > HTML <span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">菜单转换到</span>html<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">文件。</span></li>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;"></span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">用<a href="https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/gist.github.com"><span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);">gists</span></a>或者</span>github<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">分享你的</span>notebook<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">文件。这两个都可以呈现</span>notebook<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">,示例见<a href="https://github.com/dataquestio/solutions/blob/master/Mission202Solution.ipynb"><span style="color: #e4af0a">链接</span></a></span></li>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: ".PingFang SC"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;"></span>如果你把自己的<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">notebook</span>文件上传到<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">github</span>的仓库,可以使用很便利的<a href="http://mybinder.org/"><span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);">Mybinder</span></a>服务,允许另一个人进行半个小时的<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">Jupyter</span>交互连接到你的仓库。</li>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: ".PingFang SC"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;"></span>用<a href="https://github.com/jupyterhub/jupyterhub"><span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);">jupyterhub</span></a>建立你自己的系统,这样你在组织微型课堂或者工作坊,无暇顾及学生们的机器时就非常便捷了。</li>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;"></span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">将你的</span>notebook<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">存储在像</span>dropbox<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">这样的网站上,然后把链接放在<a href="http://nbviewer.jupyter.org/"><span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);">nbviewer</span></a>,</span>nbviewer<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">可以呈现任意来源的</span>notebook<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">。</span></li>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;"></span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">用菜单</span>File > Download as > PDF <span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">保存</span>notebook<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">为</span>PDF<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">文件。如果你选择本方法,我强烈建议你读一读</span>Julius Schulz<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">的<a href="http://blog.juliusschulz.de/blog/ultimate-ipython-notebook"><span style="color: #e4af0a">文章</span></a></span></li>
<li style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><span style="font-stretch: normal; font-size: 10px; line-height: normal; font-family: Menlo;"></span><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">用</span>Pelican<span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">从你的</span>notebook<a href="https://www.dataquest.io/blog/how-to-setup-a-data-science-blog/"><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC"; color: rgb(228, 175, 10);">创建一篇博客</span></a><span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">。</span></li>
</ul>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><img src="resources/F8EB46796C3CDF6C4273DED59E210A2F.jpg" alt="Pasted Graphic_2.tiff" width="593" height="254"></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><img src="resources/84993FD25D1122C170680FC72B3CEAA4.jpg" alt="Pasted Graphic 1.tiff" width="593" height="297"></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><img src="resources/0D0DA2D18084B48BA585B827974D517C.jpg" alt="Pasted Graphic 2.tiff" width="567" height="261"></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: ".PingFang SC"; color: rgb(69, 69, 69);">鲜为人知的是,你可以通过修改内核选项<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">ast_note_interactivity</span>,使得<span style="font-stretch: normal; line-height: normal; font-family: "Helvetica Neue";">Jupyter</span>对独占一行的所有变量或者语句都自动显示,这样你就可以马上看到多个语句的运行结果了。</p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);">from IPython.core.interactiveshell import InteractiveShell</p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);">InteractiveShell.ast_node_interactivity = "all"</p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);">Shift + M <span style="font-stretch: normal; line-height: normal; font-family: ".PingFang SC";">合并</span>cell. </p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);">A = insert cell above</p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);">B = insert cell below</p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);">Shift + Enter = run the cell</p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><img src="resources/9168066E6A12D5D752AA7D5A02E89814.jpg" alt="Pasted Graphic_3.tiff" width="674" height="381"></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"></p></div><div class="cell code-cell"><div class="ace-chrome"><div class="ace_static_highlight ace_show_gutter" style="counter-reset:ace_line 0"><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_paren ace_lparen">{</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span> <span class="ace_string">"MarkdownCell"</span>: <span class="ace_paren ace_lparen">{</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span> <span class="ace_string">"cm_config"</span>: <span class="ace_paren ace_lparen">{</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_indent-guide"> </span> <span class="ace_string">"lineWrapping"</span>: <span class="ace_identifier">true</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span> <span class="ace_paren ace_rparen">}</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span> <span class="ace_paren ace_rparen">}</span>,
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span> <span class="ace_string">"CodeCell"</span>: <span class="ace_paren ace_lparen">{</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span> <span class="ace_string">"cm_config"</span>: <span class="ace_paren ace_lparen">{</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_indent-guide"> </span> <span class="ace_string">"lineWrapping"</span>: <span class="ace_identifier">true</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span> <span class="ace_paren ace_rparen">}</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span> <span class="ace_paren ace_rparen">}</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_paren ace_rparen">}</span>
</div></div></div></div><div class="cell text-cell"><p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><img src="resources/6B405722B05C7F563658A0FBD4A89C5B.jpg" alt="Pasted Graphic_4.tiff" width="480" height="152"></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(228, 175, 10);"><span style="text-decoration: underline"><a href="https://github.com/dunovank/jupyter-themes">dunovank/jupyter-themes: Custom Jupyter Notebook Themes<span style="color: rgb(228, 175, 10);"></span></a></span></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 14px;"><span style="text-decoration: underline"></span><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><img src="resources/01EE622DF2771AFB7EBB977EE03DE605.jpg" alt="Pasted Graphic 1_1.tiff" width="583" height="222"></p>
<p style="margin: 0px 0px 2px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><b>Set Plotting Styles (from within notebook)</b></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69); min-height: 15px;"><b></b><br></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"><b></b></p></div><div class="cell code-cell"><div class="ace-chrome"><div class="ace_static_highlight ace_show_gutter" style="counter-reset:ace_line 0"><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_identifier">context</span> <span class="ace_keyword">and</span> <span class="ace_identifier">font</span> <span class="ace_identifier">scaling</span> <span class="ace_identifier">borrowed</span> <span class="ace_keyword">from</span> <span class="ace_identifier">seaborn</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_keyword">from</span> <span class="ace_identifier">jupyterthemes</span> <span class="ace_keyword">import</span> <span class="ace_identifier">jtplot</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># currently installed theme will be used to</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># set plot style if no arguments provided</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_identifier">jtplot</span>.<span class="ace_identifier">style</span><span class="ace_paren ace_lparen">(</span><span class="ace_paren ace_rparen">)</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># select an alternative theme's plot style by name</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># oceans16 | grade3 | chesterish | onedork | monokai | solarized-light</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_identifier">jtplot</span>.<span class="ace_identifier">style</span><span class="ace_paren ace_lparen">(</span><span class="ace_string">'onedork'</span><span class="ace_paren ace_rparen">)</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># set "context" (paper, notebook, talk, or poster)</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># & font scale (scalar applied to labels, legend, etc.)</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_identifier">jtplot</span>.<span class="ace_identifier">style</span><span class="ace_paren ace_lparen">(</span><span class="ace_identifier">context</span><span class="ace_keyword ace_operator">=</span><span class="ace_string">'paper'</span>, <span class="ace_identifier">fscale</span><span class="ace_keyword ace_operator">=</span><span class="ace_constant ace_numeric">1.4</span><span class="ace_paren ace_rparen">)</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># turn on x and y ticks (default=False)</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># & turn off axis grid (default=True)</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_identifier">jtplot</span>.<span class="ace_identifier">style</span><span class="ace_paren ace_lparen">(</span><span class="ace_identifier">ticks</span><span class="ace_keyword ace_operator">=</span><span class="ace_constant ace_language">True</span>, <span class="ace_identifier">grid</span><span class="ace_keyword ace_operator">=</span><span class="ace_constant ace_language">False</span><span class="ace_paren ace_rparen">)</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_comment"># fully reset matplotlib default rcParams</span>
</div><div class="ace_line"><span class="ace_gutter ace_gutter-cell" unselectable="on"></span><span class="ace_identifier">jtplot</span>.<span class="ace_identifier">reset</span><span class="ace_paren ace_lparen">(</span><span class="ace_paren ace_rparen">)</span>
</div></div></div></div><div class="cell text-cell"><p style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);"></p><div><br></div></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div><div class="cell text-cell"></div></div>
<script>document.body.onkeyup = function(e) {
if (e.keyCode === 39) window.location.href = 'Pandas.html';
if (e.keyCode === 37) window.location.href = 'MySQL.html';
}</script>
</body>
</html>