跳转至

Advanced examples(高级示例)

This page explores examples of advanced transforms and workflows to clean and prepare your data in the Preparations interface.

Write an expression

Preparation's Apply expression feature allows you to use Contour's rich expression language to write advanced transformations on data columns. Learn more about the expressions syntax and function reference.

Reuse a preparation on a different dataset

  1. Duplicate the preparation by choosing Duplicate file from the action menu indicated by the downward arrow beside the preparation file name.

  2. To change the starting dataset, first scroll to the starting dataset at the bottom of the changelog.

  3. Next, click the settings menu and choose Change.

  4. Finally, select the desired starting dataset.

:::callout{theme="warning"} Some differences in the schema or data of the updated dataset (for example, different column names or types) might be incompatible with changes made in the preparation. If so, you will see an error message and changes highlighted in red. Remove indicated changes as necessary. :::

Use multiple output dataset branches

It is possible for a preparation to use multiple output dataset branches. Instructions for doing so are found below.

Create a new branch

  1. Click the branch selector dropdown in the header underneath the preparation name.
  2. Enter the new branch name in the popover and click the Create branch button.

Save to a different branch

  1. Click the Actions menu button, then select Save to another branch. In the update dataset dropdown, select the branch to which you wish to save.

  2. Confirm the prompt and click Save.

Switch the current branch

Click the branch selector dropdown in the header underneath the preparation name. Type in the input field to filter the list of available branches.

Restore a saved version

  1. Switch to the branch of the saved version you wish to restore.
  2. Click the Actions dropdown button and click the Restore saved version option.


中文翻译


高级示例

本页将探讨在 Preparations 界面中使用高级转换(transforms)和工作流(workflows)来清理和准备数据的示例。

编写表达式

Preparations 的 Apply expression 功能允许您使用 Contour 丰富的表达式语言(expression language)对数据列执行高级转换。了解更多关于表达式语法和函数参考的信息。

在不同数据集上复用准备操作

  1. 通过点击准备文件名称旁向下箭头所示的操作菜单,选择 Duplicate file 来复制该准备操作。

  2. 要更改起始数据集,首先滚动到变更日志底部的起始数据集。

  3. 接着,点击设置菜单并选择 Change

  4. 最后,选择所需的起始数据集。

:::callout{theme="warning"} 更新后数据集的模式(schema)或数据(例如,不同的列名或类型)可能存在差异,这些差异可能与准备操作中的更改不兼容。如果出现这种情况,您将看到错误信息,并且相关更改会以红色高亮显示。请根据需要移除指示的更改。 :::

使用多个输出数据集分支

一个准备操作可以使用多个输出数据集分支(output dataset branches)。具体操作说明如下。

创建新分支

  1. 点击标题中准备名称下方的分支选择器下拉菜单。
  2. 在弹出的输入框中输入新分支名称,然后点击 Create branch 按钮。

保存到不同分支

  1. 点击 Actions 菜单按钮,然后选择 Save to another branch。在更新数据集下拉菜单中,选择您希望保存到的分支。

  2. 确认提示信息,然后点击 Save

切换当前分支

点击标题中准备名称下方的分支选择器下拉菜单。在输入框中输入内容以筛选可用分支列表。

恢复已保存版本

  1. 切换到您希望恢复的已保存版本所在的分支。
  2. 点击 Actions 下拉按钮,然后点击 Restore saved version 选项。