You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "mroeschke (via GitHub)" <gi...@apache.org> on 2023/03/17 19:25:18 UTC

[GitHub] [arrow] mroeschke opened a new issue, #34614: DOC: to_pylist returns a pandas.Timestamp instead of datetime.datetime when the type is timestamp[ns]

mroeschke opened a new issue, #34614:
URL: https://github.com/apache/arrow/issues/34614

   ### Describe the enhancement requested
   
   ```
   In [2]: import pyarrow as pa; from datetime import datetime
   
   In [4]: pa.array([datetime(2023, 1, 1)], type=pa.timestamp("ns")).to_pylist()
   Out[4]: [Timestamp('2023-01-01 00:00:00')]
   ```
   
   From the docs, I assumed `Convert to a list of native Python objects.` means I should always expected a `datetime.datetime`object, but since I suppose it cannot handle nanosecond components this method returns a `pandas.Timestamp` when the unit is `"ns"`
   
   ### Component(s)
   
   Python


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

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


[GitHub] [arrow] jorisvandenbossche commented on issue #34614: DOC: to_pylist returns a pandas.Timestamp instead of datetime.datetime when the type is timestamp[ns]

Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on issue #34614:
URL: https://github.com/apache/arrow/issues/34614#issuecomment-1474356332

   > but since I suppose it cannot handle nanosecond components this method returns a `pandas.Timestamp` when the unit is `"ns"`
   
   That's a correct assumption. I don't think there is anything to do about that? (except for raising an error instead, given that datetime.datetime can't handle nanoseconds)


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] mroeschke commented on issue #34614: DOC: to_pylist returns a pandas.Timestamp instead of datetime.datetime when the type is timestamp[ns]

Posted by "mroeschke (via GitHub)" <gi...@apache.org>.
mroeschke commented on issue #34614:
URL: https://github.com/apache/arrow/issues/34614#issuecomment-1474368751

   Yeah would be good to document this behavior. Or as you mentioned potentially raising. Or warning that nanosecond components would be dropped if storing in a datetime.datetime. I don't have a strong preference either way.


-- 
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: github-unsubscribe@arrow.apache.org

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