amol- commented on a change in pull request #10101:
URL: https://github.com/apache/arrow/pull/10101#discussion_r616774759



##########
File path: python/pyarrow/array.pxi
##########
@@ -1170,7 +1170,13 @@ cdef class Array(_PandasConvertible):
         array = PyObject_to_object(out)
 
         if isinstance(array, dict):
-            array = np.take(array['dictionary'], array['indices'])
+            if zero_copy_only or not self.null_count:
+                # zero_copy doesn't allow for nulls to be in the array
+                array = np.take(array['dictionary'], array['indices'])
+            else:
+                missings = array["indices"] < 0
+                array = np.take(array['dictionary'], array['indices'])
+                array[missings] = np.NaN

Review comment:
       I think that my question was mostly in terms of consistency.
   
   Given
   ```
   da = pa.DictionaryArray.from_arrays(pa.array([0, None]), pa.array(['a']))
   ```
   
   If 
   ```
   da.to_pandas()[1] == NaN
   ```
   
   shouldn't
   ```
   da.to_numpy()[1] == da.to_pandas()[1]
   ``` 
   
   woundn't it be confusing that in one case you get back `NaN` and in the 
other `None`?




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to