O'Reilly logo
  • Yui-Wah Lee thinks this is interesting:

sumCount.map(lambda key, xy: (key, xy[0]/xy[1])).collectAsMap()

From

Cover of Learning Spark

Note

Should be:
sumCount.map(lambda (key, xy): (key, xy[0]/xy[1])).collectAsMap()

Otherwise got error: lambda takes exactly 2 arguments (1 given)