From c9223240d9821e9caacd6a1dc30158d0fcb0204b Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sat, 1 Apr 2023 12:42:03 -0700 Subject: [PATCH] Backport PR #52332 on branch 2.0.x (Use date32 for pyarrow date) (#52350) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport PR #52332: Use date32 for pyarrow date Co-authored-by: Ádám Lippai --- pandas/core/arrays/arrow/array.py | 2 +- pandas/tests/extension/test_arrow.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/arrays/arrow/array.py b/pandas/core/arrays/arrow/array.py index 8612f5a4718cd..8e1774c1ea45e 100644 --- a/pandas/core/arrays/arrow/array.py +++ b/pandas/core/arrays/arrow/array.py @@ -1999,7 +1999,7 @@ def _dt_second(self): @property def _dt_date(self): - return type(self)(self._data.cast(pa.date64())) + return type(self)(self._data.cast(pa.date32())) @property def _dt_time(self): diff --git a/pandas/tests/extension/test_arrow.py b/pandas/tests/extension/test_arrow.py index 4f38d1e6ed7dd..d7543173a25ce 100644 --- a/pandas/tests/extension/test_arrow.py +++ b/pandas/tests/extension/test_arrow.py @@ -2155,7 +2155,7 @@ def test_dt_properties(prop, expected): result = getattr(ser.dt, prop) exp_type = None if isinstance(expected, date): - exp_type = pa.date64() + exp_type = pa.date32() elif isinstance(expected, time): exp_type = pa.time64("ns") expected = pd.Series(ArrowExtensionArray(pa.array([expected, None], type=exp_type)))