Reputation: 7067
I have following list structure-
List(List("NA", "NA"), List((datastore1,1857.75,1787.2559,70.49414,0,0,2), "NA"),
List("NA", "NA"), List("NA", (datastore1,1857.75,1787.2559,70.49414,0,0,2)))
I want following output -
List((datastore1,1857.75,1787.2559,70.49414,0,0,2)
my list contains "NA" element (which is fixed when something goes wrong). I want to remove this from all elements and also want single element for all duplicates. I want to
1) group list on the basis of first element (say datastore1 here)
2) remove List that contains all the elements as "NA".
2) If the list contains on single/more elements as NA, remove these elements and keep other as it is..
Currently I am using 'filternot' but it returns empty list.
How do I get above given output using scala??
Upvotes: 1
Views: 257
Reputation: 40500
Still not sure I understand what you want here. After removing "NA", you end up with a list of lists of tuples. What do you want to do with it? Mainly, I am not getting the significance of it being a list of lists ... Something like this, maybe?
list.flatten.filterNot(_ == "NA").distinct
Upvotes: 1