Bryan Cutler created ARROW-7723:
-----------------------------------

             Summary: [Python] StructArray  timestamp type with timezone 
to_pandas convert error
                 Key: ARROW-7723
                 URL: https://issues.apache.org/jira/browse/ARROW-7723
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
            Reporter: Bryan Cutler


When a {{StructArray}} has a child that is a timestamp with a timezone, the 
{{to_pandas}} conversion outputs an int64 instead of a timestamp
{code:java}
In [1]: import pyarrow as pa 
   ...: import pandas as pd 
   ...: arr = pa.array([{'start': pd.Timestamp.now(), 'end': 
pd.Timestamp.now()}]) 
   ...:                                                                         
                                             

In [2]: arr.to_pandas()                                                         
                          
Out[2]: 
0    {'end': 2020-01-29 11:38:02.792681, 'start': 2...
dtype: object

In [3]: ts = pd.Timestamp.now()                                                 
                                             

In [4]: arr2 = pa.array([ts], type=pa.timestamp('us', tz='America/New_York'))   
                                             

In [5]: arr2.to_pandas()                                                        
                          
Out[5]: 
0   2020-01-29 06:38:47.848944-05:00
dtype: datetime64[ns, America/New_York]

In [6]: arr = pa.StructArray.from_arrays([arr2, arr2], ['start', 'stop'])       
                                             

In [7]: arr.to_pandas()                                                         
                          
Out[7]: 
0    {'start': 1580297927848944000, 'stop': 1580297...
dtype: object

{code}
from https://github.com/apache/arrow/pull/6312



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to