Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • System Modeler

    Multidomain modeling and simulation of complex systems

  • Compute ServicesUse with Mathematica and Wolfram|One
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Wolfram|Alpha

  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs

AI Products

  • Wolfram AI Ecosystem
  • Wolfram Foundation Tool
  • Wolfram Cloud MCP
  • Wolfram Local MCP
  • Agent One API
  • CAG Component APIs

Core Technologies of Wolfram Products

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

Additional Deployment Options

  • Wolfram Cloud
  • Wolfram Web Engine
  • wolframscript
  • WSTPServer
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

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

Wolfram Consulting

Data Science, Finance & Business

  • Artificial Intelligence
  • Data Science
  • Healthcare
  • Real Estate

Engineering

  • Civil Engineering
  • Automotive Engineering
  • Sustainable Energy

Science & Technology

  • AgTech
  • Biosciences
  • Environmental Science
  • Food Science
  • Quantum Computation
  • Social and Behavioral Sciences

More Wolfram Solutions

Technology for Education

  • Research Universities
  • Colleges & Teaching Universities
  • High Schools
  • Resources for Students

Education Initiatives

  • Next-Gen EdTech
  • 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
  • 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
For AIs
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • System Modeler
    • Compute ServicesUse with Mathematica and Wolfram|One
    • AI AccessUse with Mathematica and Wolfram|One
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Wolfram|Alpha
      • Wolfram|Alpha Website
      • Wolfram|Alpha APIs
    • AI Products
      • Wolfram AI Ecosystem
      • Wolfram Foundation Tool
      • Wolfram Cloud MCP
      • Wolfram Local MCP
      • Agent One API
      • CAG Component APIs
    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • Linguistic Understanding
    • Additional Deployment Options
      • Wolfram Cloud
      • Wolfram Web Engine
      • wolframscript
      • WSTPServer
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions
    • Wolfram Consulting

    Data Science, Finance & Business

    • Artificial Intelligence
    • Data Science
    • Healthcare
    • Real Estate

    Engineering

    • Civil Engineering
    • Automotive Engineering
    • Sustainable Energy

    Science & Technology

    • AgTech
    • Biosciences
    • Environmental Science
    • Food Science
    • Quantum Computation
    • Social and Behavioral Sciences

    More Wolfram Solutions

    Technology for Education

    • Research Universities
    • Colleges & Teaching Universities
    • High Schools
    • Resources for Students

    Education Initiatives

    • Next-Gen EdTech
    • 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
      • 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
  • For AIs
  • 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
    TimeSeries[…]collection of sampled time-value pairs
    EventSeries[…]series of temporal events
    {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":

Wolfram Language code: tab = Tabular[{{2, 2.78}, {1, 3.14}, {3, 1.68}}, {"a", "b"}]
Wolfram Language code: TransformColumns[tab, "c" -> Function[#b - #a]]

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

Wolfram Language code: TransformColumns[tab, {"a" -> (2#a&), "b" -> (#b / 2&)}]

Transform existing columns into a new column:

Wolfram Language code: tab = Tabular[{{2004, 4, 1}, {2005, 4, 3}, {2006, 4, 5}}, {"a", "b", "c"}]
Wolfram Language code: TransformColumns[tab, "date" -> Function[DateObject[{#a, #b, #c}, "Day"]]]

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

Wolfram Language code: tab = EntityValue[EntityClass["Country", "CentralAmerica"], {"Population", "Area"}, "Tabular"]

Compute population density for each country:

Wolfram Language code: TransformColumns[tab, "Density" -> Function[#Population / #Area]]

Scope  (18)

Transformations  (7)

Transform an existing column in a Tabular object:

Wolfram Language code: Tabular[{{1, 2}, {3, 4}}, {"a", "b"}]
Wolfram Language code: TransformColumns[%, "a" -> Function[#a ^ 2]]

Split an existing column in a Tabular object:

Wolfram Language code: Tabular[{{1, {2004, 1}}, {3, {2005, 3}}, {5, {2006, 2}}}, {"a", "b"}]
Wolfram Language code: TransformColumns[%, {"year" -> (First[#b]&), "month" -> (Last[#b]&), "b" -> Nothing}]

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

Wolfram Language code: Tabular[{<|"c1" -> Subscript[x, 11], "c2" -> Subscript[x, 12]|>, <|"c1" -> Subscript[x, 21], "c2" -> Subscript[x, 22]|>, <|"c1" -> Subscript[x, 31], "c2" -> Subscript[x, 32]|>}]
Wolfram Language code: TransformColumns[%, "new" -> f]

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

Wolfram Language code: Tabular[{{Subscript[x, 11], Subscript[x, 12]}, {Subscript[x, 21], Subscript[x, 22]}, {Subscript[x, 31], Subscript[x, 32]}}]
Wolfram Language code: TransformColumns[%, f]

Use the operator form of TransformColumns:

Wolfram Language code: tab = Tabular[{{1, 2}, {3, 4}, {5, 6}}, {"a", "b"}]
Wolfram Language code: op = TransformColumns["b" -> Function[#b + 10]];
Wolfram Language code: op[tab]

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

Wolfram Language code: tab = Tabular[{<|"a" -> 1, "b" -> 2, "c" -> 3, "d" -> 4|>}]; TransformColumns[tab, {"e" -> (50&), "f" -> (60&), "a" -> Nothing}]

Remove three columns from the result:

Wolfram Language code: TransformColumns[tab, {"e" -> (50&), "f" -> (60&), {"a", "c", "d"} -> Nothing}]

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

Wolfram Language code: tab = Tabular[{{1, 2, 3, 5}, {8, 7, 6, 4}}]; TransformColumns[tab, #1[[2]] + #1[[4]]&]

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

Wolfram Language code: TransformColumns[tab, Apply[#2 + #4&]]

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

Wolfram Language code: tab = ToTabular[{f[x] -> Power[Sin[x] ^ Range[5]]}, "Columns"]
Wolfram Language code: TransformColumns[tab, f'[x] -> Function[D[#[Key[f[x]]], x]]]
Wolfram Language code: TransformColumns[tab, f'[x] -> Function[D[Slot[Key[f[x]]], x]]]

Input Data  (3)

Transform a list of associations:

Wolfram Language code: data = {<|"a" -> 1, "b" -> 2|>, <|"a" -> 3, "b" -> 4|>};

Modify an existing column:

Wolfram Language code: TransformColumns[data, "a" -> Function[#a ^ 2]]

Create a new column as a function of existing columns:

Wolfram Language code: TransformColumns[data, "c" -> Function[#a + #b]]

Transform a Dataset object:

Wolfram Language code: dataset = Dataset[{<|"a" -> 2, "b" -> "foo"|>, <|"a" -> 3, "b" -> "bar"|>}]
Wolfram Language code: TransformColumns[dataset, "a" -> Function[#a ^ 2]]

Transform the columns of a normal matrix:

Wolfram Language code: MatrixForm[matrix = {{1, "one"}, {2, "two"}, {3, "three"}}]
Wolfram Language code: TransformColumns[matrix, Total]
Wolfram Language code: TransformColumns[matrix, {f, g}]

Columnwise Operations  (4)

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

Wolfram Language code: tab = ToTabular[<|"c" -> {3.71, -2.7, -5.29, 9.33, 6.26}|>, "Columns"]; TransformColumns[tab, "c-μ" -> (#c - ColumnwiseValue[Mean[#c]]&)]

Find which elements in a column are above the median:

Wolfram Language code: tab = ToTabular[<|"c" -> {4.24, 1.14, -7.38, 6.74, 6.22, 7.5}|>, "Columns"];TransformColumns[tab, "above median" -> (#c > ColumnwiseValue[Median[#c]]&)]

Include a constant column with the median value:

Wolfram Language code: TransformColumns[tab, {"median" -> (ColumnwiseValue[Median[#c]]&), "above median" -> (#c > ColumnwiseValue[Median[#c]]&)}]

Compute the median only once by using the operator form:

Wolfram Language code: (TransformColumns["median" -> (ColumnwiseValue[Median[#c]]&)] /* TransformColumns["above_median" -> (#c > #median&)])[tab]

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

Wolfram Language code: tab = ToTabular[<|"v" -> {2.07, -0.75, 4.16, 7.28, 8.63, 7.93}|>, "Columns"]; TransformColumns[tab, "a" -> (ColumnwiseThread[Accumulate[#v]]&)]

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

Wolfram Language code: TransformColumns[tab, "alist" -> (ColumnwiseValue[Accumulate[#v]]&)]

Take a Tabular object:

Wolfram Language code: tab = ToTabular[{"old" -> {a, b, c}}, "Columns"]

TransformColumns by default operates sequentially on each row:

Wolfram Language code: TransformColumns[tab, "new" -> Function[Echo[#old, "row: "] + Echo[RandomInteger[5], " random: "]]]

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

Wolfram Language code: TransformColumns[tab, "new" -> Function[Echo[#old, "row: "] + ColumnwiseValue[Echo[Total[#old], "total: "]]]]

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

Wolfram Language code: TransformColumns[tab, "new" -> Function[ColumnwiseThread[Echo[#old, "column: "] + Echo[RandomInteger[5], " random: "]]]]

Placement of Columns  (2)

Take a Tabular object:

Wolfram Language code: tab = Tabular[{<|"a" -> 1, "b" -> 2, "c" -> 3|>, <|"a" -> 10, "b" -> 20, "c" -> 30|>}]

By default, TransformColumns places new columns at the end:

Wolfram Language code: TransformColumns[tab, "new" -> Function[#b + #c]]

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

Wolfram Language code: TransformColumns[tab, {"b", "new" -> Function[#b + #c]}]

Place the new column after column "a":

Wolfram Language code: TransformColumns[tab, {"a", "new" -> Function[#b + #c]}]

Place the new column before column "a":

Wolfram Language code: TransformColumns[tab, {"new" -> Function[#b + #c], "a"}]

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

Wolfram Language code: tab = Tabular[{<|"a" -> 1, "b" -> 2, "c" -> 3, "d" -> 4|>}]; TransformColumns[tab, {"e" -> (50&), "f" -> (60&), "a"}]

By default, new columns are appended on the right:

Wolfram Language code: TransformColumns[tab, {"e" -> (50&), "f" -> (60&)}]

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

Wolfram Language code: TransformColumns[tab, {"e" -> (50&), "a", "b", "f" -> (60&)}]

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

Wolfram Language code: TransformColumns[tab, {"e" -> (50&), "a", "b", "f" -> (60&), "a" -> Nothing}]

Missing Fallback  (2)

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

Wolfram Language code: tab = Tabular[{{1, 3, 5}, {2, Missing[], 6}}, {"a", "b", "c"}]

Use row values from the previous column:

Wolfram Language code: TransformColumns[tab, "b" -> Function[MissingFallback[#b, #a]]]

Use row values from the next column:

Wolfram Language code: TransformColumns[tab, "b" -> Function[MissingFallback[#b, #c]]]

Use a fixed value:

Wolfram Language code: TransformColumns[tab, "b" -> Function[MissingFallback[#b, -99]]]

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

Wolfram Language code: tab = Tabular[{{1, 3, 5}, {2, Missing[], 6}, {7, 8, 9}}, {"a", "b", "c"}]

Use the sum of row values from other columns:

Wolfram Language code: TransformColumns[tab, "b" -> Function[MissingFallback[#b, #a + #c]]]

Use the mean of row values from neighboring columns:

Wolfram Language code: TransformColumns[tab, "b" -> Function[MissingFallback[#b, Mean[{#a, #c}]]]]

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:

Wolfram Language code: name = {"Statistics", "KidneyTransplant"}; ExampleData[name, "ColumnDescriptions"]
Wolfram Language code: Tabular[ExampleData[name], ExampleData[name, "ColumnHeadings"]]

Use TransformColumns to give meaning to the numerically encoded data:

Wolfram Language code: transplants = TransformColumns[%, {"Delta" -> (#Delta /.  {0 -> "dead", 1 -> "alive"}&), "Gender" -> (#Gender /.  {1 -> "male", 2 -> "female"}&), "Race" -> (#Race /.  {1 -> "white", 2 -> "black"}&)}]

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

Wolfram Language code: PivotTable[transplants, UnitConvert[Quantity[Mean[#Time], "Days"], "Years"]&, "Race", "Gender", IncludeGroupAggregates -> True]

Weather Data  (1)

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

Wolfram Language code: data = Tabular[IconizedObject[«JFK weather»]]

Remove the rows containing at least one missing value:

Wolfram Language code: data1 = Discard[data, Count[#, _Missing] > 0&]

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

Wolfram Language code: chill[t_, v_] := If[t > 10 || v < 5, t, 13.12 + 0.6215 * t + (0.3965 * t - 11.37) * (v ^ 0.16), Missing[]];

Create a Tabular object with new column:

Wolfram Language code: TransformColumns[data1, {"date", "temperature", "wind_chill" -> Function[chill[#temperature, #"wind_speed"]]}]

Visualize:

Wolfram Language code: DateListPlot[% -> {{"date", "temperature"}, {"date", "wind_chill"}}, PlotLegends -> {"temperature", "wind_chill"}]

Lake Mead Levels  (1)

Time series of Lake Mead water levels:

Wolfram Language code: ts = TemporalData[TimeSeries, {{{Missing[], Quantity[708.7, "Feet"], Quantity[701.7, "Feet"], Quantity[752.4, "Feet"], Quantity[806.6, "Feet"], Quantity[909.1, "Feet"], Quantity[928.4, "Feet"], Quantity[925.9, "Feet"], Quantity[920.8, "Feet"], ... fication[DateObject[{1935, 1, 31}, "Day"], {2024, 6, 30, 0, 0, 0}, "EndOfMonth", "DayRange"]}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}, ValueDimensions -> 1}}, True, 14.2];

Create a Tabular object:

Wolfram Language code: tab1 = ToTabular[ts, "TimeSeries"]

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

Wolfram Language code: tab2 = TransformColumns[tab1, {"Year" -> Function[DateValue[#Date, "Year"]], "Month" -> Function[DateValue[#Date, "MonthName"]], "Date" -> Nothing}]

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

Wolfram Language code: tab3 = PivotToColumns[tab2, "Month" -> "Value"]

Tree Data  (1)

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

Wolfram Language code: tab = ResourceData["Sample Tabular Data: NYC Trees"]

Extract column keys:

Wolfram Language code: ColumnKeys[tab]

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

Wolfram Language code: newtab = TransformColumns[tab, {"longitude", "geoposition" -> Function[GeoPosition[{#latitude, #longitude}]]}]
Wolfram Language code: ColumnKeys[newtab]

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

Wolfram Language code: GeoGraphics[Point[Normal[newtab[ ;; 1000, "geoposition"]]]]

Properties & Relations  (3)

TransformColumns keeps all the columns not being transformed:

Wolfram Language code: tab = Tabular[{{1, 2}, {3, 4}, {5, 6}}, {"a", "b"}]
Wolfram Language code: TransformColumns[tab, "b" -> (#b^2&)]

ConstructColumns keeps only the listed columns:

Wolfram Language code: ConstructColumns[tab, "b" -> Function[#b ^ 2]]

TransformColumns can be used to remove columns:

Wolfram Language code: tab = Tabular[{{1, 2}, {3, 4}, {5, 6}}, {"a", "b"}]
Wolfram Language code: TransformColumns[tab, "a" -> Nothing]

Equivalently, use DeleteColumns:

Wolfram Language code: DeleteColumns[tab, "a"]

Take a Tabular object whose columns are years and months:

Wolfram Language code: data = {{2024, 10}, {2024, 11}, {2024, 12}};
Wolfram Language code: tab = Tabular[data, {"year", "month"}]

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

Wolfram Language code: TransformColumns[tab, "date" -> DateObject @* Values]
Wolfram Language code: TransformColumns[tab, "date" -> (DateObject[{#year, #month}, "Month"]&)]

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

Wolfram Language code: InsertColumns[tab, "date" -> Map[DateObject, data]]

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) | Updated in 2026 (15.0)

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

Text

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

CMS

Wolfram Language. 2025. "TransformColumns." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2026. 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_2026_transformcolumns, author="Wolfram Research", title="{TransformColumns}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/TransformColumns.html}", note=[Accessed: 01-September-2026]}

BibLaTeX

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

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • AI Access
  • Compute Services
  • System Modeler

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

  • Wolfram Engine
  • Wolfram Player

  • 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
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English