[~]$ cd PycharmProjects/jupyter/ [~/PycharmProjects/jupyter]$ conda activate jupyter-env (jupyter-env) [~/PycharmProjects/jupyter]$ jupyter notebook
これでブラウザが起動して、開発環境が起動する
PyCharm? からも Jupyter Notebook を起動できるし、ソッチのほうが便利 → Python 開発環境 PyCharm#s1303bb3
| Noteの保存 | [File]-[Save and Checkpoint] |
| Noteの終了 | [File]-[Close and Halt] |
| Jupyter notebookの終了 | jupyter notebook を起動したコンソールで Crtl+C。いきなりプロセスが落ちるのではなく、確認ダイアログが表示される![]() |
※ 特に設定を変更しなければ notebook は 120 秒ごとに自動保存される (左上に "(autoseved)" と表示される)
[New]-[Python3]
# Python の lambda 式
* lambda式は無名変数です
* "lambda 引き数 : 処理" のように書きます
* 主に map や filter の引き数に使います

$$
\left(
\begin{array}{c}
x' \\
y' \\
1
\end{array}
\right)
=
\left(
\begin{array}{ccc}
m_{11} & m_{21} & d_{x} \\
m_{12} & m_{22} & d_{y} \\
0 & 0 & 1
\end{array}
\right)
\left(
\begin{array}{c}
x \\
y \\
1
\end{array}
\right)
$$
!uname -srv
!のあとに Shell コマンドを記述して実行できる
ln[1] %matplotlib inline
ln[2] import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111) # row1 col1 1st subplot
dat = [0,1]
ax.plot(dat)
plt.show()from IPython.display import display for cnt in rante(10) df = pd.DataFrame(...) display(df)
ln[1] work = %pwd
ln[2] with open(work + '/test.txt','r') as f:
for row in f:
print row.strip()
ln[3] %lsln[1] %time sum(range(10000)) ln[2] %timeit sum(range(10000))
%timeは1回実行。%timeit は 1000回実行時間のうち上位3位を表示
ln[3] %timeit -n 100 -r 5 sum(range(10000))
が100回実行時間のうち上位5位を表示
[Lubuntu 計算マシン] -------- [Macbook] Corei7 6Core:12TH 32GB Mem GTX1080 8GBあるいは
[Lubuntu on VMWare] --------- [Macbook] 2Core 4GB Mem
$ sudo apt-get install avahi
(jupyter-env) atsushi@atsushi-virtual-machine:~/PycharmProjects/jupyter$ jupyter notebook --ip=* --no-browser
[W 11:21:41.967 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 11:21:41.973 NotebookApp] Serving notebooks from local directory: /home/atsushi/PycharmProjects/jupyter
[I 11:21:41.973 NotebookApp] 0 active kernels
[I 11:21:41.973 NotebookApp] The Jupyter Notebook is running at:
[I 11:21:41.973 NotebookApp] http://atsushi-virtual-machine:8888/?token=9c5551e3a29bdc15f505b8af52b4385d9297021b617208f9
[I 11:21:41.973 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:21:41.973 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://atsushi-virtual-machine:8888/?token=9c5551e3a29bdc15f505b8af52b4385d9297021b617208f9&token=9c5551e3a29bdc15f505b8af52b4385d9297021b617208f9http://atsushi-virtual-machine.local:8888
$ jupyter notebook --generate-configで ~/.jupyter/ に設定ファイルが出力されるので、それを編集する