Convert a spark DataFrame to pandas DF
In my case the following conversion from spark dataframe to pandas dataframe worked:
pandas_df = spark_df.select("*").toPandas()
following should work
Sample DataFrame
some_df = sc.parallelize([
("A", "no"),
("B", "yes"),
("B", "yes"),
("B", "no")]
).toDF(["user_id", "phone_number"])
Converting DataFrame to Pandas DataFrame
pandas_df = some_df.toPandas()