Repository navigation
GH-55490: [Python] Preserve timezone in dictionary timestamp pandas conversion - #55504
S-h-u-b-h-1 wants to merge 1 commit into
Conversation
…ndas conversion AI assisted with implementation and tests. Prepared as a draft pending contributor review.
|
|
|
|
1 similar comment
|
|
|
|
|
Hi @rok — this PR addresses GH-55490 by preserving timezone metadata for dictionary-encoded timestamp categories, with regression tests across timestamp units, chunked arrays, and pandas conversion options. The upstream Python/Dev workflows currently show |
Rationale for this change
Fixes #55490. Dictionary-encoded timestamp columns currently lose their timezone when converted to pandas categoricals. Comparisons against timezone-aware timestamps can then silently return incorrect results.
What changes are included in this PR?
Are these changes tested?
Built native Arrow C++ 27.0.0-SNAPSHOT and PyArrow from base
976779b2aac587f51b87c3bd2e6ae4c36f75ab6cplus this patch on Linux, Python 3.12, GCC 14.2 and NumPy 2.5.4.test_pandas.py: 426 passed / 11 skipped with pandas 3.1.1; 421 passed / 16 skipped with pandas 2.3.3.test_array.pyandtest_table.py: 28 passed / 1 skipped.git diff --checkpassed.The new regressions produced 28 failures and 13 passes against released PyArrow 26.0.1 before the fix. The full repository suite and macOS/Windows builds have not been run. Optional integrations were not built.
Are there any user-facing changes?
Dictionary-encoded timezone-aware timestamps retain timezone-aware pandas categories instead of becoming naive. The reported UTC comparison now returns
[True, True, False]. No public API signatures change.This PR contains a "Critical Fix". It addresses silently incorrect timezone information and comparison results.
Was AI used for this PR?
PR code and description written by:
Reviewed before submission by: