Skip to main content
This gem runs in .

Overview

Use the Reformat gem to:
  • rename columns
  • create calculated columns
  • modify existing column values
  • change data types
  • select which columns appear in the output dataset
Use expressions and functions to transform values, combine columns, clean data, or create new derived fields.
The gem has a corresponding interactive gem example. See Interactive gem examples to learn how to run sample pipelines for this and other gems.

Common transformation examples

GoalExample expression
Rename a columnSet Target column to the new column name
Create a full name column`first_name’ ‘last_name`
Convert text to uppercaseUPPER(customer_name)
Replace null valuesCOALESCE(region, 'Unknown')
Create a calculated fieldprice * quantity
Convert a value to a stringCAST(order_id AS STRING)
Extract part of a dateYEAR(order_date)

Parameters

ParameterDescriptionRequired
ModelInput dataset to transformTrue
Target columnOutput column nameFalse
ExpressionExpression to compute target columnRequired if a Target column is present
If no columns are selected, then all columns are passed through to the output.

Preview transformed data

Run the Reformat gem to generate preview results. After the initial run, the Data tab displays how your transformations affect the output dataset. As you edit expressions, the preview updates automatically so you can immediately verify the results of your changes.

Visualize data flow

You can preview the changes that the Reformat gem will make by either:
  1. Clicking the the Visualize Data Flow icon to the right of an expression, or
  2. Clicking the Data button at the bottom of the Reformat gem visual editor.
When enabled:
  • Input columns referenced by the expression are highlighted in the input data preview.
  • The output column produced by the expression is highlighted in the output preview highlights update automatically as you edit the expression.
This view helps you understand column dependencies and verify how output values are derived from source data.
You must run the Reformat gem at least once before preview data and data flow visualizations are available.
visualize data flow

Common issues

Column not found

Verify that:
  • The column name exists in the input dataset.
  • The column name uses the correct capitalization.
  • The column reference is spelled correctly.

Type mismatch errors

Some functions and operators require specific data types. For example:
  • Numeric calculations require numeric columns.
  • String functions require text values.
Use CAST() to convert values when needed.

Null values causing unexpected results

Some expressions return NULL when one or more input values are NULL. Use COALESCE() to replace null values with defaults.

Duplicate column names

Output column names must be unique.

Similar tools and concepts

The Reformat gem can be used to:
  • rename columns
  • create calculated fields
  • modify existing column values
  • select output columns
You may recognize similar behavior from:
  • SQL SELECT expressions and aliases
  • the Alteryx Formula and Select tools
  • PySpark select() and withColumn()
  • Pandas column transformations