Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18378#discussion_r123399287
  
    --- Diff: python/pyspark/sql/dataframe.py ---
    @@ -1721,7 +1721,8 @@ def toPandas(self):
             1    5    Bob
             """
             import pandas as pd
    -        return pd.DataFrame.from_records(self.collect(), 
columns=self.columns)
    +        dtype = {field.name: _to_numpy_type(field.dataType) for field in 
self.schema}
    +        return pd.DataFrame.from_records(self.collect(), 
columns=self.columns).astype(dtype)
    --- End diff --
    
    converting rows to column format is also costly I think, so if users wanna 
performance here, they should enable the arrow optimization :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to