GitHub user BryanCutler opened a pull request:

    https://github.com/apache/spark/pull/19646

    [SPARK-22147][PYTHON] Fix for createDataFrame from pandas.DataFrame with 
timestamp

    ## What changes were proposed in this pull request?
    
    Currently, a pandas.DataFrame that contains a timestamp of type 
'datetime64[ns]' when converted to a Spark DataFrame with `createDataFrame` 
will interpret the values as LongType. This fix will check for a timestamp type 
and convert it to microseconds which will allow Spark to read as TimestampType.
    
    ## How was this patch tested?
    
    Added unit test to verify Spark schema is expected for TimestampType and 
DateType when created from pandas

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/BryanCutler/spark 
pyspark-non-arrow-createDataFrame-ts-fix-SPARK-22417

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/19646.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #19646
    
----
commit cca6757b36fbe8a73a81570625f5efa6e24bd8c6
Author: Bryan Cutler <[email protected]>
Date:   2017-11-02T23:03:00Z

    added fix for pandas timestamp to convert to microseconds for 
createDataFrame

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to