Joris Van den Bossche created ARROW-7023:
--------------------------------------------

             Summary: [Python] pa.array does not use "from_pandas" semantics 
for pd.Index
                 Key: ARROW-7023
                 URL: https://issues.apache.org/jira/browse/ARROW-7023
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
            Reporter: Joris Van den Bossche
            Assignee: Joris Van den Bossche
             Fix For: 1.0.0


{code}
In [15]: idx = pd.Index([1, 2, np.nan], dtype=object)                           
                                                                                
                                                   

In [16]: pa.array(idx)                                                          
                                                                                
                                                   
Out[16]: 
<pyarrow.lib.DoubleArray object at 0x7f2e24300780>
[
  1,
  2,
  nan
]

In [17]: pa.array(idx, from_pandas=True)                                        
                                                                                
                                                   
Out[17]: 
<pyarrow.lib.Int64Array object at 0x7f2e242d3678>
[
  1,
  2,
  null
]

In [18]: pa.array(pd.Series(idx))                                               
                                                                                
                                                   
Out[18]: 
<pyarrow.lib.Int64Array object at 0x7f2e242d3780>
[
  1,
  2,
  null
]
{code}

We should probably handle Series and Index the same in this regard.



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

Reply via email to