ColumnwiseValue

ColumnwiseValue[cbody]

denotes that cbody, a part of the body of a function, will be evaluated once in columnwise form before using that function to transform rows in TransformColumns or ConstructColumns operations.

Details

  • ColumnwiseValue is typically used as part of the Function body of the transformations performed on tabular data, to precompute some partial results.
  • When transforming a Tabular object tab with Function[head[,ColumnwiseValue[cbody],]], any instances of #col in cbody will be replaced with the entire column tab[[All,col]] and then evaluated to get the value cval. The transformation function becomes Function[head[,cval,]].

Examples

open allclose all

Basic Examples  (1)

Compute the mean of a column and subtract it from all the entries of that column:

Scope  (2)

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

This is equivalent to first computing the mean value once and then subtracting it in every row:

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:

Properties & Relations  (2)

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

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:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_columnwisevalue, author="Wolfram Research", title="{ColumnwiseValue}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/ColumnwiseValue.html}", note=[Accessed: 15-January-2025 ]}

BibLaTeX

@online{reference.wolfram_2024_columnwisevalue, organization={Wolfram Research}, title={ColumnwiseValue}, year={2025}, url={https://reference.wolfram.com/language/ref/ColumnwiseValue.html}, note=[Accessed: 15-January-2025 ]}