You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/12/21 09:50:37 UTC

[GitHub] [arrow] jorisvandenbossche commented on a change in pull request #8957: ARROW-10768: [Python] pass ndim to pandas make_block

jorisvandenbossche commented on a change in pull request #8957:
URL: https://github.com/apache/arrow/pull/8957#discussion_r546606821



##########
File path: python/pyarrow/pandas_compat.py
##########
@@ -730,15 +733,18 @@ def _reconstruct_block(item, columns=None, extension_columns=None):
             block_arr, categories=item['dictionary'],
             ordered=item['ordered'])
         block = _int.make_block(cat, placement=placement,
-                                klass=_int.CategoricalBlock)
+                                klass=_int.CategoricalBlock, ndim=ndim)
     elif 'timezone' in item:
         dtype = make_datetimetz(item['timezone'])
+        cls = dtype.construct_array_type()
+        block_arr = cls._simple_new(block_arr, dtype=dtype)

Review comment:
       this line seems to cause the failures on latest pandas. So if the previous way was working, I would keep it that way (in addition, although pyarrow is already using private APIs here, `_simple_new` is even more a private implementation detail, so I would prefer not using it)

##########
File path: python/pyarrow/pandas_compat.py
##########
@@ -730,15 +733,18 @@ def _reconstruct_block(item, columns=None, extension_columns=None):
             block_arr, categories=item['dictionary'],
             ordered=item['ordered'])
         block = _int.make_block(cat, placement=placement,
-                                klass=_int.CategoricalBlock)
+                                klass=_int.CategoricalBlock, ndim=ndim)
     elif 'timezone' in item:
         dtype = make_datetimetz(item['timezone'])
+        cls = dtype.construct_array_type()
+        block_arr = cls._simple_new(block_arr, dtype=dtype)

Review comment:
       In addition, the `dtype.construct_array_type()` line is failing on older pandas releases. So reverting this change might solve that as well.




----------------------------------------------------------------
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:
users@infra.apache.org