大鄧強力推薦-jupyter notebook使用小技巧

1. 快捷鍵
在jupyter notebook菜單欄有Help按鈕,可以查看jupyter的快捷鍵

大鄧強力推薦-jupyter notebook使用小技巧

2. 將多個變量輸出
一般jupyter notebook默認只打印最後一個變量的結果。比如

大鄧強力推薦-jupyter notebook使用小技巧

大鄧強力推薦-jupyter notebook使用小技巧
通過設置InteractiveShell.astnodeinteractivity參數爲all,就可以讓所有的變量或者聲明都能顯示出來
大鄧強力推薦-jupyter notebook使用小技巧
大鄧強力推薦-jupyter notebook使用小技巧


3. 問號?
除了Help菜單能讓我們快讀查看numpy、pandas、scipy和matplotlib庫,其實在cell中使用 ?可以查看庫、函數、方法和變量的信息。

大鄧強力推薦-jupyter notebook使用小技巧
大鄧強力推薦-jupyter notebook使用小技巧
大鄧強力推薦-jupyter notebook使用小技巧
4. 在notebook中畫圖
作圖最常用的就是matplotlib,記得在cell中寫上這句



大鄧強力推薦-jupyter notebook使用小技巧
大鄧強力推薦-jupyter notebook使用小技巧

5. IPython魔法命令
大鄧強力推薦-jupyter notebook使用小技巧

查看當前工作目錄

%
pwd

執行上面的代碼,得到


'/Users/suosuo/Desktop/20180820 jupyter notebook技巧'

更改當前工作目錄

大鄧強力推薦-jupyter notebook使用小技巧
查看目錄文件列表
大鄧強力推薦-jupyter notebook使用小技巧
大鄧強力推薦-jupyter notebook使用小技巧


大鄧強力推薦-jupyter notebook使用小技巧
6. 執行shell命令

命令行的命令前面加個 !即可在notebook中進行。

比如我們想要安裝jieba庫,需要打開終端輸入
大鄧強力推薦-jupyter notebook使用小技巧

7. markdown標記語言
大鄧強力推薦-jupyter notebook使用小技巧
一級標題

# 一級標題

二級標題

## 二級標題

三級標題


### 三級標題

有序列表

元素1

元素2

元素3

大鄧強力推薦-jupyter notebook使用小技巧

大鄧強力推薦-jupyter notebook使用小技巧

會被MathJax渲染成

大鄧強力推薦-jupyter notebook使用小技巧

大鄧強力推薦-jupyter notebook使用小技巧

大鄧強力推薦-jupyter notebook使用小技巧

大鄧強力推薦-jupyter notebook使用小技巧

而在.ipynb文件中增加了下圖的這個按鈕,點擊該按鈕我們就可以使用jupyter的展示功能(瀏覽器PPT功能)

大鄧強力推薦-jupyter notebook使用小技巧


!
pip3 install jupyter_contrib_nbextensions

!
jupyter contrib nbextension install 

!
jupyter_contrib_nbextensions
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章