You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/11/12 09:41:36 UTC

[GitHub] [spark] pralabhkumar edited a comment on pull request #34401: [SPARK-30537][PYTHON], Fix toPandas wrong dtypes when applied on empty DF when Arrow enabled

pralabhkumar edited a comment on pull request #34401:
URL: https://github.com/apache/spark/pull/34401#issuecomment-966244527


   @HyukjinKwon 
   
   There is another way to do the same using pyarrow  . Below is the code for the same . 
   tmp_schema = [pyarrow.field(tmp_column_names[i],to_arrow_type(
               TimestampNTZType() if isinstance(self.schema.fields[i].dataType, TimestampType)
               else self.schema.fields[i].dataType
           ),)
       for i in range(len(self.columns))
   ]
   
   pdf = (
       pyarrow.schema(tmp_schema)
       .empty_table()
       .to_pandas()
       .set_index([pd.Index([])])
   )
   pdf.columns = self.column
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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