HyukjinKwon opened a new pull request, #48466:
URL: https://github.com/apache/arrow/pull/48466

   ### Rationale for this change
   
   
https://github.com/apache/arrow/blob/0bfbd19bce3e10163537b349f9205b635c87eea7/python/pyarrow/src/arrow/python/arrow_to_pandas.cc#L1655-L1656
   
   This was first introduced in 
https://github.com/apache/arrow/commit/9b1b3979b499dc06b71a31b2696534550503d6e2 
. For Python conversion path, we already truncate at 
https://github.com/apache/arrow/commit/9ca682bd9bc5c13fb1b99742c529e27629dcff7a 
so I believe we should make it consistent.
   
   ### What changes are included in this PR?
   
   This PR truncates truncate intraday milliseconds when converting Arrow 
instances to pandas instances.
   
   ### Are these changes tested?
   
   Yes, unittests were added, and tested as below:
   
   ```
   pytest pyarrow/tests/test_pandas.py
   ```
   
   ### Are there any user-facing changes?
   
   Yes. 
   
   ```python
   import numpy as np
   import pyarrow as pa
   import pandas as pd
   milliseconds_at_midnight = 1525910400000  # 2018-05-10 00:00:00
   milliseconds_with_time = 1525910400000 + 7425678  # + 2h 3m 45.678s
   arr = pa.array([milliseconds_at_midnight, milliseconds_with_time],
                  type=pa.date64())
   arr.to_pandas(date_as_object=False)
   ```
   
   Before:
   
   ```
   0   2018-05-10 00:00:00.000
   1   2018-05-10 02:03:45.678
   dtype: datetime64[ms]
   ```
   
   After:
   
   ```
   0   2018-05-10
   1   2018-05-10
   dtype: datetime64[ms]
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to