pyspark.sql.DataFrame.toPandas¶
-
DataFrame.
toPandas
()¶ Returns the contents of this
DataFrame
as Pandaspandas.DataFrame
.This is only available if Pandas is installed and available.
Note
This method should only be used if the resulting Pandas’s
DataFrame
is expected to be small, as all the data is loaded into the driver’s memory.Note
Usage with spark.sql.execution.arrow.pyspark.enabled=True is experimental.
>>> df.toPandas() age name 0 2 Alice 1 5 Bob
New in version 1.3.