MissingFallback[arg1,arg2,…]
gives the first argument argi that is not MissingQ.
MissingFallback
MissingFallback[arg1,arg2,…]
gives the first argument argi that is not MissingQ.
Details
- MissingFallback is typically used in TransformColumns and ConstructColumns to indicate how to proceed when Missing values are found.
- If all arguments of MissingFallback are of the form Missing[…], then the last one of them will be returned.
Examples
open all close allBasic Examples (2)
MissingFallback gives the first of its arguments that is not of the form Missing[…]:
MissingFallback[1, 2]MissingFallback[Missing[], 2]MissingFallback[Missing["reason"], Missing[], 2]If only missing elements are present, the last of them will be returned:
MissingFallback[Missing["Unknown"], Missing["NotAvailable"]]Use MissingFallback to replace missing values in a Tabular object with values of another column:
tab = Tabular[{{1, 3, 5}, {2, Missing[], 6}}, {"a", "b", "c"}]TransformColumns[tab, "b" -> Function[MissingFallback[#b, #a]]]TransformColumns[tab, "b" -> Function[MissingFallback[#b, -99]]]Scope (1)
Use functions of columns in MissingFallback to fill in missing values in a Tabular object:
tab = ToTabular[{"a" -> {1, 2, 3}, "b" -> {4, Missing[], 6}, "c" -> {7, 8, 9}}, "Columns"]Use the sum of row values from other columns:
TransformColumns[tab, "b" -> Function[MissingFallback[#b, #a + #c]]]Use the mean of row values from neighboring columns:
TransformColumns[tab, "b" -> Function[MissingFallback[#b, Mean[{#a, #c}]]]]Applications (2)
Construct a Tabular object with a column containing the moons of Pluto:
plutoMoons = ToTabular[{"moon" -> EntityList[EntityClass["PlanetaryMoon", "PlutoMoon"]]}, "Columns"]
| |
Some of those moons have a Missing["NotAvailable"] value for the "PolarRadius" property:
TransformColumns[plutoMoons, "size" -> Function[#moon["PolarRadius"]]]Use the "Radius" property as fallback:
TransformColumns[plutoMoons, "size" -> Function[MissingFallback[#moon["PolarRadius"], #moon["Radius"]]]]Take a Tabular object of Palmer penguin data:
penguins = ResourceData["Sample Tabular Data: Palmer Penguins"]Create a pivot table of penguin species and sex distribution over the islands:
pt = PivotTable[penguins, Length[#species]&, {"island"}, {"species", "sex"}]The resulting table has missing values:
TabularStructure[pt, {ExtendedKey["Gentoo", "female"], ExtendedKey["Gentoo", "male"], ExtendedKey["Chinstrap", "female"], ExtendedKey["Chinstrap", "male"]}, "MissingCount"]Use MissingFallback to fill in Missing values to compute total of all female penguins for each island:
mf[key_] := MissingFallback[key, 0]females = ColumnKeys[pt, MatchQ[#ColumnKey, ExtendedKey[_, "female"]]&]ConstructColumns[pt, {"island", "females" -> Function[Total[mf /@ (# /@ females)]]}]Properties & Relations (2)
If all arguments of MissingFallback are Missing[…] objects, the last one is returned:
MissingFallback[Missing["reason1"], Missing[], Missing["reason2"]]The symbol Missing is not treated as a missing object:
MissingFallback[Missing, x]MissingQ[Missing]Missing[] with no arguments is treated as a missing object:
MissingFallback[Missing[], x]MissingQ[Missing[]]Related Guides
History
Text
Wolfram Research (2025), MissingFallback, Wolfram Language function, https://reference.wolfram.com/language/ref/MissingFallback.html.
CMS
Wolfram Language. 2025. "MissingFallback." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MissingFallback.html.
APA
Wolfram Language. (2025). MissingFallback. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MissingFallback.html
BibTeX
@misc{reference.wolfram_2026_missingfallback, author="Wolfram Research", title="{MissingFallback}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/MissingFallback.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_missingfallback, organization={Wolfram Research}, title={MissingFallback}, year={2025}, url={https://reference.wolfram.com/language/ref/MissingFallback.html}, note=[Accessed: 13-June-2026]}