[ 
https://issues.apache.org/jira/browse/ARROW-2121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16358992#comment-16358992
 ] 

ASF GitHub Bot commented on ARROW-2121:
---------------------------------------

robertnishihara commented on a change in pull request #1581: ARROW-2121: 
[Python] Handle object arrays directly in pandas serializer.
URL: https://github.com/apache/arrow/pull/1581#discussion_r167350906
 
 

 ##########
 File path: python/pyarrow/pandas_compat.py
 ##########
 @@ -421,11 +421,19 @@ def dataframe_to_serialized_dict(frame):
             block_data.update(dictionary=values.categories,
                               ordered=values.ordered)
             values = values.codes
-
         block_data.update(
             placement=block.mgr_locs.as_array,
             block=values
         )
+
+        # If we are dealing with an object array, pickle it instead. Note that
+        # we do not use isinstance here because _int.CategoricalBlock is a
+        # subclass of _int.ObjectBlock.
+        if type(block) == _int.ObjectBlock:
+            block_data['object'] = None
+            block_data['block'] = builtin_pickle.dumps(
+                values, protocol=builtin_pickle.HIGHEST_PROTOCOL)
 
 Review comment:
   Should we be using `_pickle_to_buffer` here? Does that make a difference?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Consider special casing object arrays in pandas serializers.
> ------------------------------------------------------------
>
>                 Key: ARROW-2121
>                 URL: https://issues.apache.org/jira/browse/ARROW-2121
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Robert Nishihara
>            Priority: Major
>              Labels: pull-request-available
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to