galipremsagar opened a new issue, #49875:
URL: https://github.com/apache/arrow/issues/49875
### Describe the bug, including details regarding any error messages,
version, and platform.
```python
import pandas as pd
import pyarrow as pa
cats = pd.DatetimeIndex(["2024-01-01",
"2024-01-02"]).tz_localize("US/Eastern")
cat = pd.Categorical(values=[cats[0], cats[1], cats[0]], categories=cats)
# pandas keeps the tz on the categories
assert str(cat.dtype.categories.dtype) == "datetime64[us, US/Eastern]"
arr = pa.array(cat, from_pandas=True)
print(arr.type) # dictionary<values=timestamp[us],
indices=int8, ordered=0>
print(arr.type.value_type) # timestamp[us] ← tz dropped
assert arr.type.value_type.tz is not None, "BUG: tz dropped from
dictionary value_type"
Contrast — the same tz-aware values convert correctly when not wrapped in
a Categorical:
pa.array(cats, from_pandas=True).type
# timestamp[us, tz=US/Eastern] ← tz preserved
```
### Component(s)
Python
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]