WOLFRAM

drops elements with head Missing from a list.

DeleteMissing[assoc]

drops elements whose values have head Missing from the association assoc.

DeleteMissing[expr,n]

applies DeleteMissing to any lists or associations that occur within the first n levels of expr.

DeleteMissing[expr,n,d]

considers an element at level n to be missing if Missing occurs within the first d levels of the element.

Details

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Delete missing elements in a list:

Out[1]=1

Delete missing values from an association:

Out[1]=1

Scope  (3)Survey of the scope of standard use cases

Delete elements with head Missing up to level 2:

Out[2]=2

Delete missing elements at all levels:

Out[4]=4

Delete elements at level 1 if they contain an element with head Missing:

Out[1]=1

Delete elements at level 1 if they contain a missing expression anywhere inside:

Out[2]=2

DeleteMissing deletes complete rules when the right-hand side is Missing:

Out[1]=1

Properties & Relations  (2)Properties of the function, and connections to other functions

DeleteMissing[expr] deletes missing elements at the top level only:

Out[1]=1

DeleteMissing[list] is effectively equivalent to DeleteCases[list,_Missing]:

Out[2]=2

Possible Issues  (1)Common pitfalls and unexpected behavior

DeleteMissing does not enter heads other than List or Association:

Out[1]=1
Out[2]=2
Wolfram Research (2014), DeleteMissing, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteMissing.html (updated 2015).
Wolfram Research (2014), DeleteMissing, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteMissing.html (updated 2015).

Text

Wolfram Research (2014), DeleteMissing, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteMissing.html (updated 2015).

Wolfram Research (2014), DeleteMissing, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteMissing.html (updated 2015).

CMS

Wolfram Language. 2014. "DeleteMissing." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/DeleteMissing.html.

Wolfram Language. 2014. "DeleteMissing." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/DeleteMissing.html.

APA

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

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

BibTeX

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

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

BibLaTeX

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

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