June 2017
Beginner to intermediate
296 pages
7h 4m
English
Next, we can just call max on that key/value ID, which will find the maximum key/value. This will basically give us back the entry for the superhero ID with the most co-occurrences:
mostPopular = flipped.max()
Finally, we need to look up a name so we can actually display who that is. As you can see in line 25, we're going to use that names RDD that we created earlier to look up the name for the character ID. This will give us back the value from that key/value pair – [1]. This value is simply a list that contains a single string, so we extract that value using the array operator 0:
mostPopularName = namesRdd.lookup(mostPopular[1])[0]
This will give us back the actual name string itself ...
Read now
Unlock full access