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.

How Reformat works

The Reformat gem processes each row individually and applies expressions to generate output columns. You can:
  • keep existing columns
  • rename columns
  • modify column values
  • create new columns
  • remove unwanted columns
If no columns are selected, all input columns are passed through unchanged.

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