如何在 JupyterLab 中拆分和合并单元格

2024-01-04

  • In Jupyter实验室 https://jupyterlab.readthedocs.io/en/latest/,给定以下代码单元格,如何将其拆分为多个单元格?
  • 同样,给定以下单元格,如何将它们组合成单个单元格?

直接使用 JupyterLab(而不是在 IDE 中)工作时。

  • JupyterLab: splitCell https://jupyterlab.readthedocs.io/en/latest/api/functions/notebook.NotebookActions.splitCell.html
    • Source https://github.com/jupyterlab/jupyterlab/blob/main/packages/notebook/src/actions.tsx#L155
  • In order to split one cell into many cells:
    • Place cursors where the split is desired, and then press and release ctrl + shift + -
    • Multiple cursors may be placed, by holding ctrl, and clicking the location for the cursor.
  • JupyterLab: mergeCells https://jupyterlab.readthedocs.io/en/latest/api/functions/notebook.NotebookActions.mergeCells.html
    • Source https://github.com/jupyterlab/jupyterlab/blob/main/packages/notebook/src/actions.tsx#L252
  • In order to merge multiple cells, into one cell:
    • Select the desired, consecutive cells, by holding shift, and clicking in the margin, where the [ ] is, which will highlight the selected cells.
    • While still holding shift, press m, and then release both keys.
  • The resulting merged cell, will have a space between the code from each cell, as does the first image in this answer.
    • 这是预期的行为newModel.value.text = toMerge.join('\n\n'); https://github.com/jupyterlab/jupyterlab/blob/master/packages/notebook/src/actions.tsx#L226

资源

  • JupyterLab 阅读文档 https://jupyterlab.readthedocs.io/en/latest/api/index.html
  • 所有笔记本操作 https://jupyterlab.readthedocs.io/en/latest/api/modules/notebook.NotebookActions.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 JupyterLab 中拆分和合并单元格 的相关文章

随机推荐

  • Android SearchView 样式下拉弹出窗口

    我想知道如何设计Android 4 0的下拉弹出窗口的样式SearchView 我正在使用Theme Sherlock Light DarkActionBar 但我不知道如何将下拉搜索样式设置为白色背景和黑色文本 由于某种原因 使用 sea
  • 多行字符串中的 YAML 注释

    YAML 是否支持多行字符串中的注释 我正在尝试做这样的事情 但验证器抛出错误 key comment value comment value value comments here don t work either 不 根据YAML 1
  • 在 CakePHP 中使用 HighchartsPHP 库

    我正在尝试使用ghunti的HighchartsPHP http www goncaloqueiros net highcharts phpCakePHP 中的包装器 以便我可以在我的项目中使用它 在演示中它说要编辑config php并包
  • Java 输入流到 Python (PY4J)

    我正在使用 PY4J 在 python 中运行 Java 代码 http py4j sourceforge net http py4j sourceforge net 我的java函数返回一个InputStream 我想在我的python代
  • 从 CDN 延迟加载

    是否可以从外部服务器加载惰性模块 我想将我的资源上传到 CDN 但似乎惰性模块是从我的 node js 服务器加载的 这对我来说并不好 我的服务器仅提供角度应用程序的index html 但资源将从cdn加载 它启动并正常工作 直到加载一个
  • 如何在不将文件存储在服务器端的情况下向浏览器提供 PDF?

    我有两个方法 一种在服务器端生成 PDF 另一种在客户端下载 PDF 我怎样才能做到这一点而不将其存储在服务器端并允许客户端直接下载它 以下是两种方法 public void downloadPDF HttpServletRequest r
  • 如何取回现有的消息队列 ID

    我正在使用 msgget 系统调用来获取新的消息队列 我在其中使用了 IPC CREAT 和 IPC EXCL 标志 喜欢message queue msgget ftok tmp 100 0666 IPC CREAT IPC EXCL 现
  • Python copy:如何继承默认的复制行为?

    好吧 这可能是一个愚蠢的问题 但我现在找不到答案 我需要实现一个对象的复制 我想要复制该对象的所有属性 除了我想要完全控制复制的一两个属性 这是对象的标准复制行为 gt gt gt class test object def init se
  • 尝试在 MatLab 中编译 C mex 文件

    嘿 我试图在 MatLab 中编译一个 C 文件 但我收到了这个错误 我正在尝试理解它 非常感谢任何和所有指导 gt gt mex BDS unpack mex5 c xcrun error SDK macosx10 7 cannot be
  • Python IndexError:列表索引超出范围

    我试图让 Python 用 500 只股票的收盘价填充列表 虽然该代码似乎只适用于少数股票 但数量过多就会带来问题 Python 不断给我以下错误 OneClose append Data i 4 IndexError list index
  • 将数据从 C++ 传递到 PHP

    我需要将一个值从 PHP 传递到 C 我想我可以用 PHP 来做passthru 功能 然后我希望 C 对该值执行某些操作并将结果返回给 PHP 这是我无法解决的问题 有谁知道如何将数据从 C 传递到 PHP 我不想使用中间文件 因为我认为
  • 如何使用VBA截取网页截图?

    如何在Excel中使用VBA截取网页截图 问题是 屏幕截图只能通过按键盘的 F6 键来进行 因为 Screenhunter 就是用于此目的的 打印屏幕键被禁用 我使用了以下代码 但意识到无法使用sendkey函数 sub test appl
  • Numpy n 个奇数根(包括负值)

    我想在Python中计算一些数字的n次奇根 Numpy 作为立方根函数 使用该函数我可以计算 x 1 3 x np linspace 100 100 100 np cbrt x gt gt gt array 4 64158883 4 268
  • 如何设置 CultureInfo.InvariantCulture 默认值?

    当我在 C 中有这样一段代码时 double a 0 003 Console WriteLine a 它打印 0 003 如果我还有另一段代码 double a 0 003 Console WriteLine a ToString Cult
  • Mathematica:如何清除符号的缓存,即取消设置无模式的 DownValues

    我是一个糟糕的缓存器 有时 当没有人在看时 我会缓存结果而不包含完整的上下文 如下所示 f x f x x a a 2 f 1 DownValues f Out 2 HoldPattern f 1 gt 3 HoldPattern f x
  • InnoDB Write Log效率太高超过100%(1953.15%)?

    我的服务器上有 MariaDB 具有 16 32 个 CPU 核心 运行 mysqltuner 时一切似乎都正常 除了InnoDB写日志效率 采取1953 15 想知道这正常吗 或者有什么解决方案可以解决这个问题吗 感谢您的建议 InnoD
  • C++——如何重载运算符+=?

    鉴于以下代码片段 class Num public Num int iNumber 0 m iNumber iNumber Num operator const Num rhs this gt m iNumber this gt m iNu
  • 带图像的 Xamarin Forms ListView |文字|时间

    我目前正在使用 xamarin 表单构建一个混合应用程序 我正在尝试构建一个列表视图 显示带有图标和时间戳的错误 这是我想重新制作成 xamarin 形式的概念设计 我用了一个ImageCell尝试让带有一些文本的图标正常工作 但现在我想在
  • MongoDB 中复合 _id 的预期行为?

    我有一个包含 3 个数字属性的复合 id id KeyA 0 KeyBOARD 0 Key 0 相关数据库的 KeyA 有 200 万个相同值 KeyB 有 50 万个相同值的集群 我的理解是 我可以使用以下命令有效地查询 KeyA 和 K
  • 如何在 JupyterLab 中拆分和合并单元格

    In Jupyter实验室 https jupyterlab readthedocs io en latest 给定以下代码单元格 如何将其拆分为多个单元格 同样 给定以下单元格 如何将它们组合成单个单元格 直接使用 JupyterLab