Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
This is similar to ARROW-1680 but slightly different in that an error is not raised but the unit will still remain unchanged only when using a timezone
In [47]: us_with_tz = pa.timestamp('us', tz='America/New_York') In [48]: s = pd.Series([val]) In [49]: s_nyc = s.dt.tz_localize('tzlocal()').dt.tz_convert('America/New_York') In [50]: arr = pa.Array.from_pandas(s_nyc, type=us_with_tz) In [51]: arr.type Out[51]: TimestampType(timestamp[ns, tz=America/New_York]) In [52]: arr2 = pa.Array.from_pandas(s, type=pa.timestamp('us')) In [53]: arr2.type Out[53]: TimestampType(timestamp[us])
There is an easy workaround to apply the cast after creating the pyarrow.Array, which seems to work fine
In [54]: arr = pa.Array.from_pandas(s_nyc).cast(us_with_tz, safe=False) In [55]: arr.type Out[55]: TimestampType(timestamp[us, tz=America/New_York])
Attachments
Issue Links
- links to