You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "aboss123 (via GitHub)" <gi...@apache.org> on 2023/07/26 14:34:18 UTC

[GitHub] [arrow] aboss123 commented on pull request #36877: GH-36323: [Python] Fix Timestamp scalar repr error on values outside datetime range

aboss123 commented on PR #36877:
URL: https://github.com/apache/arrow/pull/36877#issuecomment-1651934403

   > There seems to be some linting issues and the following test is failing:
   > 
   > ```
   > __________________ test_sequence_timestamp_from_int_with_unit __________________
   > 
   >     @pytest.mark.pandas
   >     def test_sequence_timestamp_from_int_with_unit():
   >         # TODO(wesm): This test might be rewritten to assert the actual behavior
   >         # when pandas is not installed
   >     
   >         data = [1]
   >     
   >         s = pa.timestamp('s')
   >         ms = pa.timestamp('ms')
   >         us = pa.timestamp('us')
   >         ns = pa.timestamp('ns')
   >     
   >         arr_s = pa.array(data, type=s)
   >         assert len(arr_s) == 1
   >         assert arr_s.type == s
   > >       assert repr(arr_s[0]) == (
   >             "<pyarrow.TimestampScalar: datetime.datetime(1970, 1, 1, 0, 0, 1)>"
   >         )
   > E       assert "<pyarrow.Tim...01T00:00:01'>" == '<pyarrow.Tim... 1, 0, 0, 1)>'
   > E         - <pyarrow.TimestampScalar: datetime.datetime(1970, 1, 1, 0, 0, 1)>
   > E         + <pyarrow.TimestampScalar: '1970-01-01T00:00:01'>
   > ```
   
   Regarding this error I have a question. The docs appear to want the repr of the TimestampScalar to show datetime but perhaps it could display in a different format? As the initial issue mentions, values that are put in outside the range of the datetime values could break the repr functionality so would it be wise to change docs to show `strftime` output versus the  datetime one?


-- 
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