rberenguel edited a comment on issue #18139: [SPARK-20787][PYTHON] PySpark 
can't handle datetimes before 1900
URL: https://github.com/apache/spark/pull/18139#issuecomment-454968882
 
 
   Didn't think about that one, Arrow is at least a soft dependency. 
@HyukjinKwon: seems to at least work for the problematic area:
   
   ```python
   >>> import pandas as pd
   >>> import pyarrow as pa
   >>> import numpy as np
   >>> df = pd.DataFrame({'datetime64': 
np.array(['1901-07-13T01:23:34.123456789', '1902-01-13T12:34:56.432539784', 
'1899-08-13T05:46
   :57.437699912'], dtype='datetime64[ns]')})
   >>> b = pa.Table.from_pandas(df)
   >>> b[0].to_pandas()
   0   1901-07-13 01:23:34.123456789
   1   1902-01-13 12:34:56.432539784
   2   1899-08-13 05:46:57.437699912
   Name: datetime64, dtype: datetime64[ns]
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to