Jupyter lab 界面简介

几个好用的小功能
- tab
按住tab补全函数
- XX?
可以直接在函数后面添加“?”查看变数的文档资料
print?
# Docstring:
# print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
# Prints the values to a stream, or to sys.stdout by default.
# Optional keyword arguments:
# file: a file-like object (stream); defaults to the current sys.stdout.
# sep: string inserted between values, default a space.
# end: string appended after the last value, default a newline.
# flush: whether to forcibly flush the stream.
# Type: builtin_function_or_method
或是突然想不起来某个package中的函数怎么拼,像是.arange只能想起来ar...后面想不起来是什么,就可以用“XX?”来查看
import numpy as np
np.**ar**?
# np.ComplexWarning
# np.ModuleDeprecationWarning
# np.RankWarning
# np.ScalarType
# np.TooHardError
# np.VisibleDeprecationWarning
# np.arange ##我们需要的
# np.arccos
# ...
- %run
你可以使用 %run 命令,在Notebook中运行任意的Python文件。
还有其他一些常用命令,例如 %debug、%load_ext 和 %pwd 等。
- 运行Cell,切换Cell 类型
运行 cell 的快捷键是:shift + enter,大概会你用到最多次的一个快捷键。
Cell 的类型有三种,分别为: markdown,code 和 row 。

切换快捷键是选择 cell 之后,点击空白处,按下m键,代表转为markdown cell,y键代表转为code cell,同理r键代表转为row cell。
- 展开和收缩Cell
我们注意到每一个Cell和Output左边都有一个蓝色的线,点击该蓝线,可以收拢或者展开,如果输出内容很多或者我们暂时不关心一些cell的内容时,就可以将其收拢起来。

收起

- 拖拽 Cell
JupyterLab 非常灵活的第一点是,每一个Cell都是可以拖拽的,你不仅仅可以在单个文件内进行拖拽,还是在文件间进行拖拽,它会自从复制cell都另一个文件中。
- 灵活多窗口视图
Jupyter Lab 具有灵活的窗口视图功能,通过拖拽的方式,可以自由的添加视图:

像是 markdown 文件,可以点击右键显示菜单,选择预览进行查看。

另外如果有安装 Variableinspector 可以点击右键,将变数属性栏放在右边,便于随时查看。

欢迎关注【数据小盐罐儿】一个很“咸”的数据科学公众号,不定期分享有趣好玩的项目以及大量的学习资源
网友评论