Advertisement
Guest User

scalashaibaa_oneliner

a guest
Mar 26th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.37 KB | None | 0 0
  1.     val asd = all.map(x => (x._1, (x._2._1._3, x._2._2)))
  2.                                     //line  //age    //set                  //set
  3.     val moviesAvgByAge = asd.map(x => (x._2._1, x._2._2)).flatMap(x => x._2.map(y => ((x._1, y._1), y._2))).groupByKey
  4.     .mapValues(x => (x.reduce(_ + _).toFloat / x.size))//.top(10)(Ordering[(Float, String)].on(x => (x._2, x._1._2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement