top

RDD.top(n, key=None)

The top action returns the top n elements from an RDD, but unlike take, the elements are ordered and returned in descending order. Order is determined by the object type, such as, for example, numerical order forintegers or dictionary order for strings.

The key argument specifies the key by which to order the results to return the top n elements.

Last updated