apache / apache/arrow

[Python] Array.__str__ shows misleading output for timestamp types with time zone set

Open
#25,593 4 comments 0 reactions 0 assignees View on GitHub
Component: C++ Component: Python Status: needs champion Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

The output is being shown with UTC interpretation

```Java

In [13]: arr = pa.array([0, 1, 2], type=pa.timestamp('ns', 'America/Los_Angeles'))

In [14]: arr.view('int64')
Out[14]:

[
0,
1,
2
]

In [15]: arr.type
Out[15]: TimestampType(timestamp[ns, tz=America/Los_Angeles])

In [16]: arr
Out[16]:

[
1970-01-01 00:00:00.000000000,
1970-01-01 00:00:00.000000001,
1970-01-01 00:00:00.000000002
]
```

**Reporter**: [Wes McKinney](https://issues.apache.org/jira/browse/ARROW-9525) / @wesm

**Note**: *This issue was originally created as [ARROW-9525](https://issues.apache.org/jira/browse/ARROW-9525). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Start at the Python Array.__str__ entry point and reproduce the timestamp array example shown in the issue. Trace how timezone-aware timestamps are formatted, then verify that the displayed values no longer give a misleading UTC interpretation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.