PySpark RDD | keys method
keys(~) method returns the keys of a pair RDD that contains tuples of length two.
This method does not take in any parameters.
A PySpark RDD (
Consider the following PySpark pair RDD:
Getting the keys of a pair RDD in PySpark
To get the keys of the pair RDD as a list of strings:
Note that if the RDD is not a pair RDD, then the values are returned: