在公众号【计算机视觉联盟】后台回复【9076】获取我的AI学习笔记;我的微信:Kingsplusa;    --by 王博Kings,985AI博士,CSDN博客专家,华为云专家

 这是在逛towardsdatascience时的总结,可以学习参考一下

10 大 Jupyter Lab 扩展

 

目前,大多数在线资源都会使用以下命令来安装 Jupyter Lab 扩展:

jupyter labextension install @jupyterlab/...

 

当然,很多人都喜欢使用这种命令。如果你是 VS-Code、Sublime 或 Atom 的用户,你也许会希望在「管理器」中直接搜索要安装的内容。Jupyter Lab 却没有提供这些功能。

 

 

如上图所示,你可以转到左侧导航栏第 4 个选项卡,即扩展管理器(extension manager)。然后就可以搜索到你需要的扩展。

 

 

现在总结一下值得推荐的 10 个 Jupyter Lab 扩展。

 

JupyterLab 调试器

 

 

调试器指南:https://blog.jupyter/a-visual-debugger-for-jupyter-914e61716559

 

由于 Jupyter 的交互性,它受到了很多人的喜欢。然而,调试功能是编码所必须的。例如,我们可以逐步调试 for 循环(for-loop )来查看内部发生了什么。大多数 IDE 工具都支持这种带有「step over」和「step into」的调试特性,但遗憾的是,Jupyter 中没有这种特性。

 

「jupyterlab/debugger」就是这样一个扩展,让我们可以补足 Jupyter Lab 中缺少的这个功能。

 

图源:https://blog.jupyter/a-visual-debugger-for-jupyter-914e61716559

 

JupyterLab-TOC

 

 

JupyterLab-TOC 项目地址:https://github/jupyterlab/jupyterlab-toc

 

notebook 太长?想让你的 notebook 看起来更漂亮?或者希望 notebook 有一个目录?「jupyterlab/toc」帮你实现。

 

图源: https://github/jupyterlab/jupyterlab-toc/raw/master/toc.gif

 

有了这个扩展,基于用标题标记的单元格会自动生成目录(确保使用标记 ## 来指定你的标题级别)。这也是使用 Jupyter Notebook 的好方法,让你的工作更有系统性和组织性。

 

JupyterLab-DrawIO

 

 

JupyterLab-DrawIO 项目地址:https://github/QuantStack/jupyterlab-drawio

 

Diagram(原名 Draw.IO)是绘制图表的工具,它确实是 MS Visio 完美的开源替代品。借助于 jupyterlab-drawio,我们可以在 Jupyter Lab 上使用该工具。

 

图源:https://github/QuantStack/jupyterlab-drawio/raw/master/drawio.gif

 

JupyterLab Execution Time

JupyterLab Execution Time 项目地址:https://github/deshaw/jupyterlab-execute-time

Jupyter Notebook/Lab 的一个惊人特性是它能提供许多有用的魔术命令(magic command)。例如我们可以使用「%timeit」测试代码运行时间。它将运行代码片段数百或数千次,并得到平均值,以确保给出一个公平和准确的结果。

但有时并不需要这样精确。我们只不过想知道每个单元运行的时间,在这种情况下,为每个单元使用「%timeit」变得不合适了。

在这种情况下,我们可以使用「jupyterlab-execute-time」。

如上图所示,「jupyterlab-execute-time」不仅显示了执行单元的时间间隔,而且还显示了最后执行的时间。

JupyterLab Spreadsheet

JupyterLab Spreadsheet 项目地址:https://github/quigleyj97/jupyterlab-spreadsheet

作为一名数据科学家或数据工程师,你不得不与电子表格打交道。但是,Jupyter 本身不支持读取 Excel 文件,这迫使我们需要打开多个工具,在 Jupyter 编码以及 Excel 之间不停地切换。

「jupyterlab-spreadsheet」可以很好地解决这类问题。它在 Jupyter Lab 中嵌入了 xls/xlsx 电子表格查看功能,因此我们可以在同一个地方获得所需的一切。

 

图源: https://github/quigleyj97/jupyterlab-spreadsheet/raw/main/screenshot.png

JupyterLab System Monitor

jupyterlab-system-monitor 项目地址:https://github/jtpio/jupyterlab-system-monitor

Python 不是一种高效执行的编程语言,这意味着与其他语言相比,它可能会消耗更多的 CPU 和内存资源。Python 的最常见用例之一是数据科学。所以,我们可能想要监控自身系统硬件资源,从而注意到 Python 代码可能冻结了操作系统。

jupyterlab-topbar-extension 你想要拥有的扩展,它可以在 Jupyter Lab UI 的顶部栏显示 CPU 和内存使用情况,这样我们就可以实时监控了。如下动图所示:

图源:https://github/jtpio/jupyterlab-system-monitor/raw/main/doc/screencast.gif

JupyterLab Kite

jupyterlab-kite 项目地址:https://github/kiteco/jupyterlab-kite

虽然我很喜欢 Jupyter,但它不像其他经典 IDE 工具一样提供代码自动补全功能。Jupyter 的代码自动补全非常受限且速度很慢。

 

你可能听说过免费的 AI 赋能代码补全服务 Kite,它在 Sublime、VS Code 和 PyCharm 等几乎所有流行的 IDE 工具中都可以使用。通过 jupyterlab-kite (https://github/kiteco/jupyterlab-kite) 扩展,你也可以在 Jupyter Lab 中使用这一功能。

 

图源:https://github/kiteco/jupyterlab-kite

 

JupyterLab Variable Inspector

 

 

jupyterlab-variableInspector 项目地址:https://github/lckr/jupyterlab-variableInspector

 

如果你是从 R studio 或 Matlab 转向使用 Jupyter Lab 的数据科学家,则可能对这些工具提供的变量检测器非常熟悉。但遗憾的是,Jupyter Lab 默认不支持这一功能。这时,jupyterlab-variableInspector 扩展可以重新支持该功能。

 

图源:https://github/lckr/jupyterlab-variableInspector/raw/master/early_demo.gif

 

JupyterLab Matplotlib

 

 

Matplotlib/ipympl 项目地址:https://github/matplotlib/ipympl

 

如果你是数据科学家,则 Matplotlib 是必须学习(must-learn)的 Python 库。该库是 Python 中一个基础但强大的数据可视化工具。但当我们使用 Jupyter Lab 时,交互特征消失了。

 

jupyter-matplotlib 扩展可以使 Matplotlib 再次具备交互性。只需要输入一个魔术命令 %matplotlib widget 来启动它,则你的精美 3D 图表就变成交互式的。如下动图所示:

 

图源:https://github/matplotlib/ipympl/raw/master/matplotlib.gif

 

JupyterLab Plotly

 

 

Plotly 使用指南:https://plotly/python/getting-started/#jupyterlab-support-python-35

 

虽然 Matplotlib 是最基础和强大的数据可视化库,但在这方面我最喜欢的是 Plotly 库。该库封装了很多常见图表,我们可以通过数行代码生成令人惊叹的图表。

 

为使 Jupyter Lab 无缝支持和显示交互的 Plotly 图表,用户需要安装 jupyterlab-plotly。

 

原文链接:https://towardsdatascience/10-jupyter-lab-extensions-to-boost-your-productivity-4b3800b7ca2a

更多推荐

超赞!十大Jupyter Lab必备插件!Jupyter必备神器!