jorisvandenbossche commented on code in PR #36314:
URL: https://github.com/apache/arrow/pull/36314#discussion_r1245809241
##########
python/pyarrow/array.pxi:
##########
@@ -1476,12 +1476,17 @@ cdef class Array(_PandasConvertible):
def _to_pandas(self, options, types_mapper=None, **kwargs):
pandas_dtype = None
- try:
- pandas_dtype = self.type.to_pandas_dtype()
- except NotImplementedError:
- pass
- # pandas ExtensionDtype that implements conversion from pyarrow
+ if types_mapper:
+ pandas_dtype = types_mapper(self.type)
+ elif issubclass(type(self.type), ExtensionType):
Review Comment:
```suggestion
elif self.type.id == _Type_EXTENSION:
```
##########
python/pyarrow/array.pxi:
##########
@@ -3104,12 +3109,18 @@ cdef class ExtensionArray(Array):
def _to_pandas(self, options, **kwargs):
pandas_dtype = None
- try:
- pandas_dtype = self.type.to_pandas_dtype()
- except NotImplementedError:
- pass
+ types_mapper = kwargs.get('types_mapper', None)
+
+ if types_mapper:
+ pandas_dtype = types_mapper(self.type)
+ elif issubclass(type(self.type), ExtensionType):
Review Comment:
This check isn't needed here, since this is in the ExtensionArray subclass.
But more generally, I am wondering if this method is actually still needed
now we are adding similar logic to the base class' `to_pandas`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]