I have a list of Associations
, a:
{<|"Year" -> 2011, "Loss" -> 141972., "Factor" -> 1.02884|>,
<|"Year" -> 2009, "Loss" -> 27081., "Factor" -> 1.01863|>,
<|"Year" -> 2014, "Loss" -> 770.693, "Factor" -> Missing["Unmatched"]|>,
<|"Year" -> 2014, "Loss" -> 173.242, "Factor" -> Missing["Unmatched"]|>,
<|"Year" -> 2010, "Loss" -> 163125., "Factor" -> 1.37016|>}
If I look for the rows with Missing["Unmatched"]
, I'm successful:
Select[a, #["Factor"] == Missing["Unmatched"] &]
{<|"Year" -> 2014, "Loss" -> 770.693, "Factor" -> Missing["Unmatched"]|>,
<|"Year" -> 2014, "Loss" -> 173.242, "Factor" -> Missing["Unmatched"]|>}
But if I try to find the ones that have values, I'm unsuccessful:
Select[a, #["Factor"] != Missing["Unmatched"] &]
{}
I can do it by looking for numbers:
Select[a, NumberQ[#["Factor"]] &]
{<|"Year" -> 2011, "Loss" -> 141972., "Factor" -> 1.02884|>,
<|"Year" -> 2009, "Loss" -> 27081., "Factor" -> 1.01863|>,
<|"Year" -> 2010, "Loss" -> 163125., "Factor" -> 1.37016|>}
But I'd like to be able to get the complement of the matches, just in case there's something I need to see that's not a number. What am I missing?
UnsameQ[]
(=!=
). $\endgroup$#["Factor"]
; rather use#Factor
, the short form. $\endgroup$SameQ[]
(===
). $\endgroup$