danepitkin commented on code in PR #36314:
URL: https://github.com/apache/arrow/pull/36314#discussion_r1246872075
##########
python/pyarrow/array.pxi:
##########
@@ -1475,6 +1475,22 @@ cdef class Array(_PandasConvertible):
return self.take(indices)
def _to_pandas(self, options, types_mapper=None, **kwargs):
+ pandas_dtype = None
+
+ if types_mapper:
+ pandas_dtype = types_mapper(self.type)
+ elif self.type.id == _Type_EXTENSION:
+ try:
+ pandas_dtype = self.type.to_pandas_dtype()
+ except NotImplementedError:
+ pass
+
+ # Only call __from_arrow__ for Arrow extension types or when explicitly
+ # overridden via types_mapper
+ if hasattr(pandas_dtype, '__from_arrow__'):
+ arr = pandas_dtype.__from_arrow__(self)
+ return pandas_api.series(arr, copy=False)
Review Comment:
From my testing, `Array` does always have a `None` "column" name. Good to
know `ChunkedArray` could benefit from `copy=False`! I thought maybe it was
left out on purpose since the memory is not guaranteed to be contiguous.
--
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]