8.Jupyter notebooks

Jupyter notebooks

  • text cell
    • 可以包含文本和代码
      • 文本是以markdown组织的
      • code可以直接执行

      %matplotlib inline 会渲染matplotlib,直接在页面显示而不是单独打开一个窗口

  • Jupyter notebook是语言不唯一的
其主要的有Browser  Notebook Server Kernel

Browser进行显示,输入和编码并提交给Server
Server按照语言分法给对应的kenel
kenel运行并将运行结果返回到server
server将所有内容返回给browser进行显示

  • 魔法快捷键
    • %matplotlib
      • 线魔法:仅作用于其所在的行
    • %%matplotlib
      • 块魔法:作用于整个单元
# 程序的时间统计
%timeit
%time
%pdb

Magic Keyboard

%pdb

b 6
# 在第6行打上断点
b
# 显示已经有的断点

continue
# 运行到下一个断点
p var_name
# 查看变量值
n
# 执行下一行
s 
# 执行下一语句(会进入函数内部)
a
#执行打印函数参数

ipynb 实际上就是一个大型的json文件

jupyter nbconvert --to 'format' note_name.ipynb

#example

jupyter nbconvert --to html notebook.ipynb

猜你喜欢

转载自blog.csdn.net/a245293206/article/details/89843378