diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index e1bf494920566..7d9b65c77d25a 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -1573,7 +1573,7 @@ cdef class Array(_PandasConvertible): # decoding the dictionary will make sure nulls are correctly handled. # Decoding a dictionary does imply a copy by the way, # so it can't be done if the user requested a zero_copy. - c_options.decode_dictionaries = not zero_copy_only + c_options.decode_dictionaries = True c_options.zero_copy_only = zero_copy_only c_options.to_numpy = True @@ -1585,9 +1585,6 @@ cdef class Array(_PandasConvertible): # always convert to numpy array without pandas dependency array = PyObject_to_object(out) - if isinstance(array, dict): - array = np.take(array['dictionary'], array['indices']) - if writable and not array.flags.writeable: # if the conversion already needed to a copy, writeable is True array = array.copy() diff --git a/python/pyarrow/src/arrow/python/arrow_to_pandas.cc b/python/pyarrow/src/arrow/python/arrow_to_pandas.cc index 2115cd8015cac..cb9cbe5b930e7 100644 --- a/python/pyarrow/src/arrow/python/arrow_to_pandas.cc +++ b/python/pyarrow/src/arrow/python/arrow_to_pandas.cc @@ -2515,6 +2515,8 @@ Status ConvertChunkedArrayToPandas(const PandasOptions& options, std::shared_ptr arr, PyObject* py_ref, PyObject** out) { if (options.decode_dictionaries && arr->type()->id() == Type::DICTIONARY) { + // XXX we should return an error as below if options.zero_copy_only + // is true, but that would break compatibility with existing tests. const auto& dense_type = checked_cast(*arr->type()).value_type(); RETURN_NOT_OK(DecodeDictionaries(options.pool, dense_type, &arr));