Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Wolfram Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • System Modeler
  • Wolfram Player
  • Finance Platform
  • Wolfram Engine
  • Enterprise Private Cloud
  • Application Server
  • Wolfram|Alpha Notebook Edition
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

WolframConsulting.com

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Wolfram Notebook Assistant + LLM Kit
    • System Modeler
    • Wolfram Player
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Wolfram Engine
    • Enterprise Private Cloud
    • Application Server
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
TransformColumns
  • See Also
    • ColumnwiseValue
    • ColumnwiseThread
    • MissingFallback
    • Tabular
    • ConstructColumns
    • DeleteColumns
    • InsertColumns
    • AggregateRows
    • CastColumns
  • Related Guides
    • Tabular Transformation
    • Tabular Data Cleaning
    • Tabular Processing Overview
    • Tabular Objects
    • See Also
      • ColumnwiseValue
      • ColumnwiseThread
      • MissingFallback
      • Tabular
      • ConstructColumns
      • DeleteColumns
      • InsertColumns
      • AggregateRows
      • CastColumns
    • Related Guides
      • Tabular Transformation
      • Tabular Data Cleaning
      • Tabular Processing Overview
      • Tabular Objects

TransformColumns[tab,ncolf]

adds a new column with name ncol by transforming the tabular data tab using the function f applied to each row.

TransformColumns[tab,{ncol1f1,ncol2f2,…}]

adds several new columns ncoli by successively applying the functions fi to each row.

TransformColumns[transfs]

represents an operator form of TransformColumns that can be applied to tabular data.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Transformations  
Input Data  
Columnwise Operations  
Placement of Columns  
Missing Fallback  
Applications  
Medical Data  
Weather Data  
Lake Mead Levels  
Tree Data  
Properties & Relations  
See Also
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • ColumnwiseValue
    • ColumnwiseThread
    • MissingFallback
    • Tabular
    • ConstructColumns
    • DeleteColumns
    • InsertColumns
    • AggregateRows
    • CastColumns
  • Related Guides
    • Tabular Transformation
    • Tabular Data Cleaning
    • Tabular Processing Overview
    • Tabular Objects
    • See Also
      • ColumnwiseValue
      • ColumnwiseThread
      • MissingFallback
      • Tabular
      • ConstructColumns
      • DeleteColumns
      • InsertColumns
      • AggregateRows
      • CastColumns
    • Related Guides
      • Tabular Transformation
      • Tabular Data Cleaning
      • Tabular Processing Overview
      • Tabular Objects

TransformColumns

TransformColumns[tab,ncolf]

adds a new column with name ncol by transforming the tabular data tab using the function f applied to each row.

TransformColumns[tab,{ncol1f1,ncol2f2,…}]

adds several new columns ncoli by successively applying the functions fi to each row.

TransformColumns[transfs]

represents an operator form of TransformColumns that can be applied to tabular data.

Details and Options

  • TransformColumns is typically used to add new columns or modify existing columns, keeping the rest.
  • Possible forms of tabular data tab include:
  • Tabular[…]type-consistent tabular data
    Dataset[…]general hierarchical data
    {assoc1,assoc2,…}list of associations with common keys
    matrixmatrix of values
  • If the column ncoli already exists, it is replaced with the newly created one. Otherwise, a new column is added after the existing ones.
  • TransformColumns[tab,{col,ncolf}] adds a new column named ncol after the existing column col, instead of appending it at the end.
  • For tabular data atab without column keys, TransformColumns[atab,{f1,f2,…,fn}] appends n new anonymous columns by successively applying the functions fi to each row.
  • Functions fi are applied to individual rows of the input tabular data tab, with the row being an association <|col1val1,…|> if tab has column keys or a list {val1,…} if tab does not have column keys.
  • The syntax colNothing can be used to remove the existing column named col. »
  • TransformColumns[transfs][tab] is equivalent to TransformColumns[tab,transfs].

Examples

open all close all

Basic Examples  (3)

Transform the difference of columns "a" and "b" into a new column "c":

Double the column "a" and halve the column "b":

Transform existing columns into a new column:

Fetch the population and area of the Central American countries, expressed in Tabular form:

Compute population density for each country:

Scope  (18)

Transformations  (7)

Transform an existing column in a Tabular object:

Split an existing column in a Tabular object:

TransformColumns with a function f acts on whole rows as associations if columns are named:

On a Tabular object with anonymous columns, the rows are expressed as lists:

Use the operator form of TransformColumns:

Use "a"Nothing to remove column "a" from the result:

Remove three columns from the result:

Add the second and fourth columns to make a fifth column in a matrix:

With Apply around the function, there is an argument for each column:

Use Key in the Function body of Tabular transformations when the key is a general expression:

Input Data  (3)

Transform a list of associations:

Modify an existing column:

Create a new column as a function of existing columns:

Transform a Dataset object:

Transform the columns of a normal matrix:

Columnwise Operations  (4)

Use ColumnwiseValue to subtract the mean of a column from its values:

Find which elements in a column are above the median:

Include a constant column with the median value:

Compute the median only once by using the operator form:

Use ColumnwiseThread to compute a vector-valued transformation of entire columns:

With ColumnwiseValue, you get the same list for each row:

Take a Tabular object:

TransformColumns by default operates sequentially on each row:

TransformColumns with ColumnwiseValue[expr] evaluates expr once first, then acts on each row:

TransformColumns with ColumnwiseThread[expr] evaluates expr once, acting on whole columns:

Placement of Columns  (2)

Take a Tabular object:

By default, TransformColumns places new columns at the end:

Use column "b" as an anchor column after which the new column is placed:

Place the new column after column "a":

Place the new column before column "a":

Use column names without a transformation to anchor column placement in the result:

By default, new columns are appended on the right:

Place "e" before "a" and "f" after "b":

Place "e" first and "f" after "b" and remove "a" from the result:

Missing Fallback  (2)

Use MissingFallback to fill in missing values when transforming a Tabular object:

Use row values from the previous column:

Use row values from the next column:

Use a fixed value:

Use functions of columns in MissingFallback to fill in missing values when transforming a Tabular object:

Use the sum of row values from other columns:

Use the mean of row values from neighboring columns:

Applications  (4)

Medical Data  (1)

This data contains information on kidney transplant patients—time in days to death or on-study time since transplant at the given age:

Use TransformColumns to give meaning to the numerically encoded data:

Now use the categories to compute mean survival time in years with PivotTable:

Weather Data  (1)

Weather data from JFK airport in C, mbar and km/h:

Remove the rows containing at least one missing value:

Define the wind chill factor (adapt the formula to the units of data):

Create a Tabular object with new column:

Visualize:

Lake Mead Levels  (1)

Time series of Lake Mead water levels:

Create a Tabular object:

Split the dates into year and month columns using TransformColumns and remove "Date" column:

Use PivotToColumns to convert into a more compact form for visualization:

Tree Data  (1)

Get the data of a tree census in New York City:

Extract column keys:

Use TransformColumns to combine "latitude" and "longitude" columns into one column of GeoPosition objects and place it after the "longitude" column:

Use the "geoposition" column to plot the first 1000 tree locations:

Properties & Relations  (3)

TransformColumns keeps all the columns not being transformed:

ConstructColumns keeps only the listed columns:

TransformColumns can be used to remove columns:

Equivalently, use DeleteColumns:

Take a Tabular object whose columns are years and months:

TransformColumns can add a new column by constructing a date for each row:

Alternatively, first construct the column of dates and then use InsertColumns to append it:

See Also

ColumnwiseValue  ColumnwiseThread  MissingFallback  Tabular  ConstructColumns  DeleteColumns  InsertColumns  AggregateRows  CastColumns

Related Guides

    ▪
  • Tabular Transformation
  • ▪
  • Tabular Data Cleaning
  • ▪
  • Tabular Processing Overview
  • ▪
  • Tabular Objects

History

Introduced in 2025 (14.2)

Wolfram Research (2025), TransformColumns, Wolfram Language function, https://reference.wolfram.com/language/ref/TransformColumns.html.

Text

Wolfram Research (2025), TransformColumns, Wolfram Language function, https://reference.wolfram.com/language/ref/TransformColumns.html.

CMS

Wolfram Language. 2025. "TransformColumns." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TransformColumns.html.

APA

Wolfram Language. (2025). TransformColumns. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TransformColumns.html

BibTeX

@misc{reference.wolfram_2025_transformcolumns, author="Wolfram Research", title="{TransformColumns}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/TransformColumns.html}", note=[Accessed: 01-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_transformcolumns, organization={Wolfram Research}, title={TransformColumns}, year={2025}, url={https://reference.wolfram.com/language/ref/TransformColumns.html}, note=[Accessed: 01-December-2025]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • Notebook Assistant + LLM Kit
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Player
  • Wolfram Engine

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2025 Wolfram
© 2025 Wolfram | Legal & Privacy Policy |
English