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.
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 TimeSeries[…] a time series object EventSeries[…] an event series 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 linear 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.
- Transformation based on missing data removal includes:
-
"Delete" remove the missing value - Deleting a missing value in a particular column will remove the whole row that value belongs to. »
- 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) - The following options can be given:
-
RandomSeeding Automatic what seeding of pseudorandom generators should be done internally
Examples
open all close allBasic Examples (2)
Replace missing elements by using the mean value of the columns:
data = Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]];TransformMissing[data, "Mean"]TransformMissing[data, {"Constant", 0}]Fit a distribution on the column data and sample from it:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "a" -> {"RandomVariate", NormalDistribution[_, _]}]Scope (18)
Column Specification (4)
Transform the specified column:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "a" -> "Mean"]TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], {"a" -> "Mean", "b" -> "Median"}]TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], All -> "Median"]Transform the columns that are compatible with the "Mean" transformation:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["String" -> Association["ElementType" -> "String"],
"Number" -> Association["ElementType" -> "Integer64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{3, {0, 1, 1, 2}, "AC"}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/Q=="], "Capacity" -> 3, "BitCount" ->
2}] -> Missing[]}, "ElementType" -> "String"]],
TabularColumn[Association["Data" -> {{1, 0, 3}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["/Q=="], "Capacity" -> 3, "BitCount" -> 2}] -> Missing[]},
"ElementType" -> "Integer64"]]}}]]]], "Mean"]TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["String" -> Association["ElementType" -> "String"],
"Number" -> Association["ElementType" -> "Integer64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{3, {0, 1, 1, 2}, "AC"}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/Q=="], "Capacity" -> 3, "BitCount" ->
2}] -> Missing[]}, "ElementType" -> "String"]],
TabularColumn[Association["Data" -> {{1, 0, 3}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["/Q=="], "Capacity" -> 3, "BitCount" -> 2}] -> Missing[]},
"ElementType" -> "Integer64"]]}}]]]], Automatic -> "Mean"]Transformations (14)
Constant (4)
Impute missing values with the mean of a column:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "Mean"]Impute missing values with the median of a column:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "Median"]Impute missing values with the most common value of a column:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "Mode"]Impute missing values with a constant value:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], {"a" -> {"Constant", -1}, "b" -> {"Constant", -1}, "c" -> {"Constant", 999}}]Random (2)
Impute each missing value with a random choice from its column:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "RandomElement"]Sample from a given distribution:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], {"RandomVariate", NormalDistribution[]}]Sample after estimating the distribution on the (non-missing) column values:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], {"RandomVariate", NormalDistribution[_, _]}]Position based (3)
Replace missing values using the previous non-missing value:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "PreviousElement"]Replace missing values using the next non-missing value:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "NextElement"]Replace missing values using the closest non-missing value:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "NearestElement"]Interpolation based (2)
Impute missing values sampling from an InterpolatingFunction:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "Interpolation"]Specify an interpolation order:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], {"Interpolation", InterpolationOrder -> 0}]Delete (3)
TransformMissing[{1, 2, Missing[], 4}, "Delete"]Remove rows with missing values in a column:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "b" -> "Delete"]Remove rows with missing values in any column:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["a" -> Association["ElementType" -> "Integer64"],
"b" -> Association["ElementType" -> "Integer64"],
"c" -> Association["ElementType" -> "Real64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{1, 2, 3, 4, 0}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["7w=="], "Capacity" -> 5, "BitCount" -> 4}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {1, 2, 3, 4, Missing[]}]],
TabularColumn[Association["Data" -> {{2, 0, 0, 5, 4}, {}, DataStructure["BitVector",
{"Data" -> ByteArray["+Q=="], "Capacity" -> 5, "BitCount" -> 3}] -> Missing[]},
"ElementType" -> "Integer64", "CachedOriginalExpression" -> {2, Missing[], Missing[], 5,
4}]], TabularColumn[Association["Data" -> {{0., 3.2, 6.1, 6.1, 7.8}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/g=="], "Capacity" -> 5, "BitCount" ->
4}] -> Missing[]}, "ElementType" -> "Real64", "CachedOriginalExpression" ->
{Missing[], 3.2, 6.1, 6.1, 7.8}]]}}]]]], "Delete"]Options (1)
Applications (1)
Take a Tabular containing weather data:
data = ToTabular[TemporalData[Map[WeatherData["Chicago", #, {{2023, 12, 1}, {2023, 12, 3}}]&, obs = {"Temperature", "Pressure", "WindSpeed", "Visibility"}]], "TemporalData", Join[{"Time"}, obs]]Analyze the tabular structure to find missing counts:
TabularStructure[data]Transform missing in each column:
TransformMissing[data, {"Temperature" -> "Interpolation", "Pressure" -> "NearestElement", "WindSpeed" -> "PreviousElement", "Visibility" -> "Interpolation"}]Possible Issues (1)
Not all transformations are compatible with every data type:
TransformMissing[Tabular[Association["RawSchema" -> Association["ColumnProperties" ->
Association["String" -> Association["ElementType" -> "String"],
"Number" -> Association["ElementType" -> "Integer64"]], "KeyColumns" -> None,
"Backend" -> "WolframKernel"], "Options" -> {},
"BackendData" -> Association["ColumnData" -> DataStructure["ColumnTable",
{{TabularColumn[Association["Data" -> {{3, {0, 1, 1, 2}, "AC"}, {},
DataStructure["BitVector", {"Data" -> ByteArray["/Q=="], "Capacity" -> 3, "BitCount" ->
2}] -> Missing[]}, "ElementType" -> "String", "CachedOriginalExpression" ->
{"A", Missing[], "C"}]], TabularColumn[Association[
"Data" -> {{1, 0, 3}, {}, DataStructure["BitVector", {"Data" -> ByteArray["/Q=="],
"Capacity" -> 3, "BitCount" -> 2}] -> Missing[]}, "ElementType" -> "Integer64",
"CachedOriginalExpression" -> {1, Missing[], 3}]]}}]]]], "String" -> "Mean"]Text
Wolfram Research (2025), TransformMissing, Wolfram Language function, https://reference.wolfram.com/language/ref/TransformMissing.html (updated 2026).
CMS
Wolfram Language. 2025. "TransformMissing." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2026. 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
BibTeX
@misc{reference.wolfram_2026_transformmissing, author="Wolfram Research", title="{TransformMissing}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/TransformMissing.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_transformmissing, organization={Wolfram Research}, title={TransformMissing}, year={2026}, url={https://reference.wolfram.com/language/ref/TransformMissing.html}, note=[Accessed: 12-June-2026]}