Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-13896

[Python] Print of timestamp with timezone errors

Details

    Description

      import pyarrow as pa
      
      a = pa.array([0], pa.timestamp('s', tz='+02:00'))
      
      print(a) # representation not correct?
      # <pyarrow.lib.TimestampArray object at 0x7f834c7cb9a8>
      # [
      #  1970-01-01 00:00:00
      # ]
      
      print(a[0])
      #Traceback (most recent call last):
      #  File "<stdin>", line 1, in <module>
      #  File "pyarrow/scalar.pxi", line 80, in pyarrow.lib.Scalar.__repr__
      #  File "pyarrow/scalar.pxi", line 463, in pyarrow.lib.TimestampScalar.as_py
      #  File "pyarrow/scalar.pxi", line 393, in pyarrow.lib._datetime_from_int
      #ValueError: fromutc: dt.tzinfo is not self
      
      

      I am not really sure about this, but for a timezone of +02:00, shouldn't we represent the 0 as "1970-01-01 02:00:00 +02:00"?

      The other should not crash imo.

      Attachments

        Issue Links

          Activity

            People

              alenka Alenka Frim
              jorgecarleitao Jorge Leitão
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2.5h
                  2.5h

                  Slack

                    Issue deployment