TransformMissing
TransformMissing[tab,spec]
replaces instances of Missing[…] in tabular data tab according to the specification spec.
TransformMissing[tab,{col1spec1,…}]
uses the specification speci to replace missing elements in coli.
Details and Options
- TransformMissing is also known as missing handling and missing imputation.
- TransformMissing is used to replace missing elements in a dataset with values that can be specified or inferred from the known part of the data.
- Missing value handling is typically used to maintain dataset integrity (often required for further data processing) and to preserve the original dataset sample size.
- Possible forms of tab include:
-
{assoc1,…} a list of associations {x11,…} a matrix Dataset[…] a dataset object Tabular[…] a tabular object - Transformation specification spec based on the all the non-missing column values includes:
-
" Mean" the mean value "Median" the median value "Mode" the most frequent value - These methods assume missing data is random (MCAR) and the imputed value reflects a consistent, representative dataset, working best when data lacks skew or outliers.
- Transformation based on a constant value includes:
-
{"Constant", val} a constant value val - Transformation based on sampling includes:
-
"RandomElement" randomly selected value {"RandomVariate",dist} value sampled from dist - If the distribution dist has free parameters, these will be estimated from the non-missing data using EstimatedDistribution.
- Transformation based on the element position includes:
-
"NearestElement" use the closest non-missing element "NextElement" use the next non-missing element "PreviousElement" use the previous non-missing element - These methods assume that missing values are similar to nearby data points and are useful for filling small gaps in sequential or time-based data.
- Transformation based on interpolation includes:
-
"Interpolation" use interpolation {"Interpolation",InterpolationOrderdegree} specify the interpolation order degree - Interpolation assumes that missing data lies on a smooth, continuous path between known points, making it most effective for datasets with gradual changes and minimal sharp fluctuations.
- Additional methods can be implemented using TransformColumns and other transformation functions.
- When specifying the desired columns, coli can have the following formats:
-
n the nth column "name" the column "name" TypeSpecifier[…] columns matching the specified type All all the columns Automatic automatically find columns based on spec (default)
Examples
open allclose allBasic Examples (2)
Scope (15)
Column Specification (4)
Transformations (11)
Constant (4)
Random (2)
Position Based (3)
Interpolation Based (2)
Wolfram Research (2025), TransformMissing, Wolfram Language function, https://reference.wolfram.com/language/ref/TransformMissing.html.
Text
Wolfram Research (2025), TransformMissing, Wolfram Language function, https://reference.wolfram.com/language/ref/TransformMissing.html.
CMS
Wolfram Language. 2025. "TransformMissing." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TransformMissing.html.
APA
Wolfram Language. (2025). TransformMissing. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TransformMissing.html