arrays - groupBy multiple keys in scala - Stack Overflow
https://stackoverflow.com/questions/50906189groupBy multiple keys in scala. Ask Question. Asked 4 years, 7 months ago. Modified 4 years, 7 months ago. Viewed 2k times. 2. I have a dataframe similar to following: val df = sc.parallelize (Seq ( (100, 1, 1), (100, 1,2), (100, 2,3), (200, 1,1), (200, 2,3), (200, 2, 2), (200, 3, 1), (200, 3,2), (300, 1,1), (300,1,2), (300, 2,5), (400, 1, 6))).
Scala Tutorial - GroupBy Function Example
allaboutscala.com › scala-groupby-exampleMar 16, 2018 · The groupBy method takes a predicate function as its parameter and uses it to group elements by key and values into a Map collection. As per the Scala documentation, the definition of the groupBy method is as follows: groupBy [ K]( f: ( A) ⇒ K): immutable. Map [ K, Repr] The groupBy method is a member of the TraversableLike trait. Steps 1.