PySpark DataFrame | rdd property
Start your free 7-days trial now!
rdd property returns the RDD representation of the DataFrame. Keep in mind that PySpark DataFrames are internally represented as RDD.
Consider the following PySpark DataFrame:
Converting PySpark DataFrame into RDD
To convert our PySpark DataFrame into a RDD, use the
rdd = df.rddrdd.collect()[Row(name='Alex', age=25), Row(name='Bob', age=30)]
Here, we are using the
collect() method to see the content of our RDD, which is a list of