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



##########
File path: python/pyarrow/pandas_compat.py
##########
@@ -730,15 +733,26 @@ 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'])
+        # TODO: once older pandas is dropped, use dtype.construct_array_type()
+        #  instead of hard-coding DatetimeArray
+        try:
+            from pandas.arrays import DatetimeArray
+            block_arr = DatetimeArray(block_arr, dtype=dtype)
+        except ImportError:
+            # older pandas versions
+            from pandas import DatetimeIndex
+            block_arr = DatetimeIndex(block_arr, dtype=dtype)

Review comment:
       This is also failing on older pandas. I assume because DatetimeArray and 
DatetimeIndex might be interpreting datetime64 differently? (wall time vs unix 
time? didn't check, but I remember discussions about it)




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