I have a notebook that I am working on that starts with an imported CSV file. Many of the rows have blank data in them. I have used the following command to establish a list of associations:
test = AssociationThread[First[rawdata] -> #] & /@ Rest[rawdata]
The InputForm
of the above code produces an end result that is something like this:
test = {<|"A" -> 1, "B" -> 2, "C" -> ""|>, <|"A" -> 3, "B" -> 4,
"C" -> 5|>, <|"A" -> "", "B" -> 6, "C" -> 7|>}
I want to remove the associations that have blank values so my end result would be more like this:
test2 = {<|"A" -> 1, "B" -> 2|>, <|"A" -> 3, "B" -> 4, "C" -> 5|>, <|
"B" -> 6, "C" -> 7|>}
Is there a simple way to drop all keys across all the entries that have null values? I have looked into KeyDrop
/ KeyDropFrom
but can't figure out a way to drop a key based on its value.
Based on this thread, I am thinking there may be a way to use Position
or PositionIndex
.
Thoughts?