diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index 8e323b703af..e47327ff2d4 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -901,7 +901,16 @@ cdef class Array(_PandasConvertible): with nogil: check_status(ConvertArrayToPandas(c_options, self.sp_array, self, &out)) - return pandas_api.series(wrap_array_output(out), name=self._name) + result = pandas_api.series(wrap_array_output(out), name=self._name) + + if isinstance(self.type, TimestampType): + tz = self.type.tz + if tz is not None: + tz = string_to_tzinfo(tz) + result = (result.dt.tz_localize('utc') + .dt.tz_convert(tz)) + + return result def __array__(self, dtype=None): cdef: diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index 7a581117c4b..9aa8a7c8b48 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -1778,3 +1778,11 @@ def test_concat_array(): def test_concat_array_different_types(): with pytest.raises(pa.ArrowInvalid): pa.concat_arrays([pa.array([1]), pa.array([2.])]) + + +@pytest.mark.pandas +def test_to_pandas_timezone(): + # https://issues.apache.org/jira/browse/ARROW-6652 + arr = pa.array([1, 2, 3], type=pa.timestamp('s', tz='Europe/Brussels')) + s = arr.to_pandas() + assert s.dt.tz is not None diff --git a/python/pyarrow/tests/test_pandas.py b/python/pyarrow/tests/test_pandas.py index 86576b01be3..c8a652187ca 100644 --- a/python/pyarrow/tests/test_pandas.py +++ b/python/pyarrow/tests/test_pandas.py @@ -107,10 +107,6 @@ def _check_series_roundtrip(s, type_=None, expected_pa_type=None): assert arr.type == expected_pa_type result = pd.Series(arr.to_pandas(), name=s.name) - if pa.types.is_timestamp(arr.type) and arr.type.tz is not None: - result = (result.dt.tz_localize('utc') - .dt.tz_convert(arr.type.tz)) - tm.assert_series_equal(s, result)