Repository navigation
[Doc][Python] Timestamp with tz loses its time zone after to_numpy #45644
Copy link
Copy link
Labels
Component: DocumentationComponent: PythonType: usageIssue is a user questionIssue is a user questiongood-first-issue
Description
Activity
- changed the title
[-][Python] Timestamptz type loses its time zone after map transforming.[/-][+][Python] Timestamp with tz loses its time zone after `to_numpy`[/+]on Feb 28, 2025 This behaviour is expected as NumPy datetimes are not timezone aware, see https://numpy.org/devdocs/reference/arrays.datetime.html#datetimes-and-timedeltas.
You can convert pyarrow tz-aware timestamp array to
- numpy datetime64 with loss of tz information,
- pandas tz-aware datetime64 dtype
- a Pyhon object
arr_tz = pa.array([1735689600, 1735689600, 1735689600], type=pa.timestamp("s", tz='UTC')) # numpy datetime64 dtype (losing tz information) >>> arr_tz.to_numpy() array(['2025-01-01T00:00:00', '2025-01-01T00:00:00', '2025-01-01T00:00:00'], dtype='datetime64[s]')
# pandas tz-aware datetime64 dtype >>> arr_tz.to_pandas().array 0 2025-01-01 00:00:00+00:00 1 2025-01-01 00:00:00+00:00 2 2025-01-01 00:00:00+00:00 dtype: datetime64[s, UTC]
# python object >>> arr_tz.to_pandas(timestamp_as_object=True).to_numpy() array([datetime.datetime(2025, 1, 1, 0, 0, tzinfo=<UTC>), datetime.datetime(2025, 1, 1, 0, 0, tzinfo=<UTC>), datetime.datetime(2025, 1, 1, 0, 0, tzinfo=<UTC>)], dtype=object)
I will keep this issue open as this needs to be documented in https://arrow.apache.org/docs/python/numpy.html.
Also connected and need to go into the docs: #41162.- addedType: usageIssue is a user questionIssue is a user questionand removed
on Mar 3, 2025 - changed the title
[-][Python] Timestamp with tz loses its time zone after `to_numpy`[/-][+][Doc][Python] Timestamp with tz loses its time zone after `to_numpy`[/+]on Mar 10, 2025 - added a commit that references this issue
on Oct 2, 2025 Hello @AlenkaF
I’d like to work on documenting the timezone behavior when converting PyArrow timestamp arrays to NumPy.
I plan to add a section to the Python NumPy documentation explaining the loss of timezone info and the recommended alternatives.Hi @AlenkaF I've opened up a PR for this. Could you please take a look? 🙏
- added 4 commits that reference this issue
on Apr 23, 2026 - added a commit that references this issue
on May 5, 2026 - added a commit that references this issue
on May 26, 2026
Metadata
Metadata
Assignees
Labels
Component: DocumentationComponent: PythonType: usageIssue is a user questionIssue is a user questiongood-first-issue
Describe the bug, including details regarding any error messages, version, and platform.
Timestamptz type loses its time zone after
to_numpy.Versions / Dependencies
Reproduction script
Component(s)
Python