[转载]jupyter notebook最最常用的快捷键

关键少数几个jupyter notebook的快捷键,工具提示、模式切换等

应为不熟悉快捷键,走了一些弯路,记录下来,供学习查阅。
快捷键很多,先记住熟练应用以下几个快捷键。

1. shift+Tab 工具提示

推荐指数:☆☆☆☆☆☆(6颗星)
类似在vscode中使用ctrl+鼠标左键,可以查看进入函数内部,查看参数列表、示例等等。
与此类似,在notebook中使用shift+Tab可以显示工具提示,简直就是福音。
用法:鼠标点击到要看的函数上,shift+tab
举个栗子:
matplotlib.pyplot中绘制直方图,函数hist()参数很多,功能很多。用到的时候,不免忘记了有哪些功能、各个参数代表什么意思。

在这里插入图片描述
density不是密度吗,密度和直方图有什么关系?
参数解释:

density : bool, optional. If True, the first element of the return tuple will be the counts normalized to form a probability density, i.e.,the area (or integral) under the histogram will sum to 1.This is achieved by dividing the count by the number of observations times the bin width and not dividing by the total number of observations. If stacked is also True, the sum of the histograms is normalized to 1.
Default is None for both normed and density. If either is set, then that value will be used. If neither are set, then the args will be treated as False.If both density and normed are set an error is raised.

这解释我在vscode并没有看到(估计还是没用到应该的快捷键),总之,这里的解释很到位,超级赞!

2. 按esc进入命令模式,再按m(简写esc,c)

推荐指数:☆☆☆☆☆(5颗星)
再按m,当前单元格(官方翻译叫做代码块)转换为markdown格式。
按esc进入命令模式,按y,当前单元格转换为代码。

m和markdown是首字母关系,y和code有什么关系呢,为什么用y,不用c,实际上c已经名花有主了
官方提示,以及众多博客,都是给的大写M,这里不区分大小写…

通用规则:

esc,c :先按esc,再按c
esc+c :一起按

3. ctrl+z 后退一步

推荐指数:☆☆☆☆☆(5颗星)
后退一步,和vscode一样。
不管在什么编辑模式下,都使用

4. alt+enter 运行单元格

推荐指数:☆☆☆☆(4颗星)
运行当前单元格,新建并移动到下一格

5. esc,h 查看快捷键列表

推荐指数:☆☆☆☆☆☆(6颗星)
不用说了,你想得到的功能都在这里
当重复用了几次相同的操作,觉得麻烦的时候,找一找看看吧

Jupyter Notebook帮助文档学习

help选项下有常用包的官方文档:

在这里插入图片描述

碰到相关问题,先查看官方文档,特别是查看示例(examples),帮助很大。
例如matplotlib的官方文档,各个函数有详细的解释和示例,非常棒!

                                </div>
发布了4 篇原创文章 · 获赞 0 · 访问量 744

猜你喜欢

转载自blog.csdn.net/u013310037/article/details/103655927
今日推荐