大幅提高生产力:你需要了解的十大Jupyter Lab插件

开发 开发工具
下一代数据科学开发环境 Juypter Lab 应该怎么用?让我们从扩展工具开始。

如果你是一个用 Python 的数据科学家,那么用 Jupyter Notebook 就是大概率事件了。作为 Jupyter Notebook 的「下一代」web 应用,Jupyter Lab 提供了相比以往更多的便捷功能,其中之一就是扩展。

现在,即使是 Jupyter Lab 开发者团队也对如此蓬勃发展的第三方扩展工具社区而感到兴奋了。在这篇文章中,机器学习工程师、计算机科学博士 Christopher Tao 将为读者介绍 10 种 Jupter Lab 扩展工具,它们对于典型的数据科学家 / 工程师来说可以大幅提高生产力。

10 大 Jupyter Lab 扩展

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

  1. jupyter labextension install @jupyterlab/... 

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

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

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

1. JupyterLab 调试器

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

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

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

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

2. JupyterLab-TOC

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

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

 

 

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

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

3. JupyterLab-DrawIO

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

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

图片

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

4. JupyterLab Execution Time

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

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

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

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

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

5. JupyterLab Spreadsheet

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

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

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

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

6. JupyterLab System Monitor

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

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

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

图片

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

7. JupyterLab Kite

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

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

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

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

8. JupyterLab Variable Inspector

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

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

图片

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

9. JupyterLab Matplotlib

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

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

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

图片

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

10. JupyterLab Plotly

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

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

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

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

【本文是51CTO专栏机构“机器之心”的原创译文,微信公众号“机器之心( id: almosthuman2014)”】 

 

戳这里,看该作者更多好文

 

责任编辑:赵宁宁 来源: 51CTO专栏
相关推荐

2023-02-13 08:34:26

Linux键盘快捷键

2020-12-07 06:22:05

MyBatisPlus开发MP

2020-10-28 10:25:11

云端云计算云迁移

2016-06-15 14:19:45

Visual Stud插件

2022-01-05 08:00:00

框架Golang开源

2020-07-24 07:00:00

Scrum工具

2020-03-08 21:37:13

JavaScript前端工具

2022-01-10 10:45:16

大数据大数据动向数据技术

2024-04-01 14:24:05

数字信任人工智能

2023-04-06 09:53:21

Harbor企业级服务

2023-07-07 14:51:34

2023-10-24 15:11:42

低代码开发工具

2023-07-04 09:00:00

开发SPACE框架

2023-09-05 08:44:14

文本编辑器VS Code技巧

2021-11-09 14:39:15

人工智能AI深度学习

2010-07-28 15:02:52

Compuwareworkbench

2023-10-31 18:01:26

安全扫描代码

2012-06-26 10:13:55

2011-04-01 11:16:06

hessian

2012-06-27 09:11:47

点赞
收藏

51CTO技术栈公众号