Ciaren

Combine columns

Combine columns — combineColumns

Join several columns into one text column, separated by a separator. The inverse of Split column.

Use cases

  • Build a full name from first + last.
  • Make a composite key like region-year.
  • Assemble an address from street / city / zip.

What it does

Each selected column is cast to text and joined left-to-right with the separator. Null cells become empty strings, so the separator's position is preserved ("a" + null + "c""a||c" with separator |).

Configuration

Config keyTypeRequiredDescription
columnsstring[]YesColumns to combine (≥ 2), in order
new_columnstringYesName of the combined column
separatorstringNoText between values (default a single space)
keep_originalbooleanNoKeep the source columns (default true)

Generated Python code

df_2 = df_1.assign(full_name=lambda _d: _d['first'].astype('string').fillna('') + ' ' + _d['last'].astype('string').fillna(''))

Tips & common mistakes

  • Order matters — columns are joined in the order you pick them.
  • Turn off keep original to drop the source columns once combined.

See also