Jupyter Notebook使用技巧

Jupyter生成ppt

安装完jupyter,打开后,建立新.ipynb文件。

点击view ------ cell toolbar ------slideshow。此时每个cell右上角会出现slide type,点击下拉,出现5种选项,意思如下:

Slide:主页面,通过按左右方向键进行切换。
Sub-Slide:副页面,通过按上下方向键进行切换。
Fragment:一开始是隐藏的,按空格键或方向键后显示,实现动态效果。
Skip:在幻灯片中不显示的单元。
Notes:作为演讲者的备忘笔记,也不在幻灯片中显

Matplotlib 在 Jupyter Notebook 上面输出矢量图

import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'svg'

只显示markdown和图表

想没有想过一个场景,你的jupyter notebook是导出一个报告给业务人员看的,他们不想看到那些密密麻麻的代码,只想留下markdown和图表,在jupyter notebook加入下面这段代码就好

import IPython.core.display as di

di.display_html('<script><jQuery(function() {if (jQuery("body.notebook_app").length == 0) { jQuery(".input_area").toggle(); jQuery(".prompt").toggle();}});</script>',raw=True)

Jupyter kernels

Jupyter不但可以运行python,还可以运行很多其他语言,
比如Ruby Julia Golang R

Jupyter kernels 列出了不同语言的 Jupyter kernels

2019-04-04

%matplotlib inline

jupyter nbconvert *.ipynb --to slides 
jupyter notebook --ip=0.0.0.0 --allow-root
iruby notebook --ip=0.0.0.0 --allow-root

https://nbviewer.jupyter.org/github/NervosBeijingCommunity/jupyter-ppt/blob/master/RubySaturday20190309/gen-btc-addr.ipynb


参考:
https://www.jianshu.com/p/7cac2e5ec35b
https://github.com/SciRuby/iruby
https://github.com/dunovank/jupyter-themes
https://www.dataquest.io/blog/advanced-jupyter-notebooks-tutorial/
https://towardsdatascience.com/speed-up-jupyter-notebooks-20716cbe2025
https://zhuanlan.zhihu.com/p/37590039
https://www.zhihu.com/question/59392251/answer/177708041
https://github.com/jupyter/dashboards
https://github.com/damianavila/RISE

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容