Adam Ling created ARROW-18298:
---------------------------------

             Summary: [Python] datetime shifted when using 
pyarrow.Table.from_pandas to load a pandas DateFrame containing datetime with 
timezone
                 Key: ARROW-18298
                 URL: https://issues.apache.org/jira/browse/ARROW-18298
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
    Affects Versions: 9.0.0
         Environment: MacOS M1, Python 3.8.13
            Reporter: Adam Ling


Problem:

When using pyarrow.Table.from_pandas to load a pandas DataFrame which contains 
a timestamp object with timezone information, the created Table object will 
shift the datetime, while still keeping the timezone information. Please see my 
scripts.

 

Reproduce scripts:
{code:java}
import pandas as pd
import pyarrow
ts = pd.Timestamp("2022-10-21 22:46:17", tz="America/Los_Angeles")
df = pd.DataFrame({"TS": [ts]})
table = pyarrow.Table.from_pandas(df)

print(df)
"""
                         TS
0 2022-10-21 22:46:17-07:00
"""

print(table)
"""
pyarrow.Table
TS: timestamp[ns, tz=America/Los_Angeles]
----
TS: [[2022-10-22 05:46:17.000000000]]""" {code}
Expected results:

The table should not shift the datetime when timezone information is provided.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to