Ciaren

Split column

Split column — splitColumn

Split one text column into several columns, by a literal delimiter or by regex capture groups.

Use cases

  • Split a full name into first / last.
  • Break a code like A-100 into its parts with a regex.

What it does

Splits the source column on the delimiter (or regex capture groups) and writes one new column per name in into. Rows with fewer parts leave trailing columns null.

Before
idfull_name
1Ada Lovelace
2Grace Hopper
3Linus Torvalds
3 rows · 2 cols
Split column (column=full_name, delimiter=space, into=[first, last])
After
idfull_namefirstnewlastnew
1Ada LovelaceAdaLovelace
2Grace HopperGraceHopper
3Linus TorvaldsLinusTorvalds
3 rows · 4 cols

Configuration

Config keyTypeRequiredDescription
columnstringYesText column to split
modestringNodelimiter (default) or regex
delimiterstringConditionalDelimiter to split on (required for delimiter mode)
patternstringConditionalRegex; capture group 1 → first column, etc. (required for regex mode)
intostring[]YesNames for the resulting columns, in order
keep_originalboolNoKeep the source column (default true)

Generated Python code

_parts = df_1['name'].astype('string').str.split(' ', expand=True)
df_2 = df_1.assign(first=_parts[0], last=_parts[1])

Tips & common mistakes

  • into names the outputs in order. In regex mode, capture group 1 fills the first name, group 2 the second, and so on.
  • Uneven splits leave trailing columns null when a row has fewer parts.
  • Set keep_original: false to drop the source column after splitting.

See also