# Tag Info

5

Values @ GroupBy[list, Most, Mean] {{1, 1, (a + b)/2}, {1, 2, (c + d)/2}, {1, 3, e}} Also Mean /@ GatherBy[list, Most] {{1, 1, (a + b)/2}, {1, 2, (c + d)/2}, {1, 3, e}}

4

Converting them to associations and using Merge might be a good solution: In[1]:= KeyValueMap[Append, Merge[<|#[[1 ;; 2]] -> #[[3]]|> & /@ {{1, 1, a}, {1, 1, b}, {1, 2, c}, {1, 2, d}, {1, 3, e}}, Mean]] Out[1]= {{1, 1, (a + b)/2}, {1, 2, (c + d)/2}, {1, 3, e}}

3

Is this faster and works correctly for all your cases? list={{1,1,a},{1,1,b},{1,2,c},{1,2,d},{1,3,e}}; Mean/@Split[Sort[list],Most[#1]==Most[#2]&] (*{{1, 1, (a + b)/2}, {1, 2, (c + d)/2}, {1, 3, e}}*)

2

Testing on your sample data dataset: r1 = DeleteMissing[dataset, 1, 1] Takes 0.000530041 second r2 = dataset[Select[Not@AnyTrue[#, MissingQ] &]] Takes 0.000412052 second r3 = dataset[Select[Not@MatchQ[#, KeyValuePattern[{_ -> _?MissingQ}]] &]] Takes 0.000428904 second All have the same result: r1 == r2 == r3 (*Out: True *)

1

one way to do this is: Dataset@DeleteCases[ Normal[dataset], <|___, _ -> Missing["Unmatched"], ___|> ]; which takes $2.32$ seconds on bigDataset (in my question) Benchmarking @BenIzd 's methods and my own

Only top voted, non community-wiki answers of a minimum length are eligible