ColumnwiseThread[cbody]
denotes that cbody, a part of the body of a function, will be evaluated in columnwise form when using that function in TransformColumns or ConstructColumns operations.
ColumnwiseThread
ColumnwiseThread[cbody]
denotes that cbody, a part of the body of a function, will be evaluated in columnwise form when using that function in TransformColumns or ConstructColumns operations.
Details
- ColumnwiseThread is typically used as part of the Function body of the transformations performed on tabular data, to transform columnar data at once instead of row by row.
- When transforming a Tabular object tab with Function[head[…,ColumnwiseThread[cbody],…]], cbody will be evaluated after replacing any instances of #col with the entire column tab[[All,col]]. If the result is another column of the same length, its values will be respectively used when the transformation acts row by row.
Examples
open all close allBasic Examples (2)
Accumulate a column of a Tabular object and append the result as a new column:
Tabular[{{1}, {2}, {3}, {4}}, {"col"}]TransformColumns[%, "acc" -> Function[ColumnwiseThread[Accumulate[#col]]]]Staring with a column, compute a new one by subtracting its reverse:
Tabular[{{1}, {2}, {3}}, {"col"}]TransformColumns[%, "new" -> Function[#col - ColumnwiseThread[Reverse[#col]]]]Scope (1)
Use ColumnwiseThread to append a new column with standardized values of another column:
ToTabular[<|"c" -> {3.71, -2.7, -5.29, 9.33, 6.26}|>, "Columns"]TransformColumns[%, "new" -> Function[ColumnwiseThread[Standardize[#c]]]]Applications (1)
Take a Tabular object of numbers:
tab = ToTabular[<|"obs" -> RandomReal[{-10, 10}, 5]|>, "Columns"]Create a new column of sorted values from the column "obs":
TransformColumns[tab, "sort" -> Function[ColumnwiseThread[Sort[#obs]]]]Properties & Relations (2)
Use ColumnwiseThread to compute a vector-valued transformation of an entire column:
tab = ToTabular[<|"v" -> {2.07, -0.75, 4.16, 7.28, 8.63, 7.93}|>, "Columns"];
ConstructColumns[tab, "z" -> (ColumnwiseThread[Accumulate[#v]]&)]With ColumnwiseValue, you get the same list for each row:
ConstructColumns[tab, "zlist" -> (ColumnwiseValue[Accumulate[#v]]&)]Take a Tabular object:
tab = ToTabular[{"old" -> {a, b, c}}, "Columns"]TransformColumns by default operates sequentially on each row:
TransformColumns[tab, "new" -> Function[Echo[#old, "row: "] + Echo[RandomInteger[5], " random: "]]]TransformColumns with ColumnwiseValue[expr] evaluates expr once first, then acts on each row:
TransformColumns[tab, "new" -> Function[Echo[#old, "row: "] + ColumnwiseValue[Echo[Total[#old], "total: "]]]]TransformColumns with ColumnwiseThread[expr] evaluates expr once, acting on whole columns:
TransformColumns[tab, "new" -> Function[ColumnwiseThread[Echo[#old, "column: "] + Echo[RandomInteger[5], " random: "]]]]Related Guides
History
Text
Wolfram Research (2025), ColumnwiseThread, Wolfram Language function, https://reference.wolfram.com/language/ref/ColumnwiseThread.html.
CMS
Wolfram Language. 2025. "ColumnwiseThread." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ColumnwiseThread.html.
APA
Wolfram Language. (2025). ColumnwiseThread. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColumnwiseThread.html
BibTeX
@misc{reference.wolfram_2026_columnwisethread, author="Wolfram Research", title="{ColumnwiseThread}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/ColumnwiseThread.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_columnwisethread, organization={Wolfram Research}, title={ColumnwiseThread}, year={2025}, url={https://reference.wolfram.com/language/ref/ColumnwiseThread.html}, note=[Accessed: 12-June-2026]}