From 731db6389bc473333b95dd427a626c0a3ea41f1f Mon Sep 17 00:00:00 2001 From: laughingman7743 Date: Sun, 18 May 2025 18:57:38 +0900 Subject: [PATCH] Fix incompatible dtype conversions in dataframe. (fix #532) --- pyathena/pandas/result_set.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyathena/pandas/result_set.py b/pyathena/pandas/result_set.py index 6c586e34..8856051a 100644 --- a/pyathena/pandas/result_set.py +++ b/pyathena/pandas/result_set.py @@ -206,7 +206,9 @@ def _trunc_date(self, df: "DataFrame") -> "DataFrame": description = self.description if self.description else [] times = [d[0] for d in description if d[1] in ("time", "time with time zone")] if times: - df.loc[:, times] = df.loc[:, times].apply(lambda r: r.dt.time) + truncated = df.loc[:, times].apply(lambda r: r.dt.time) + for time in times: + df.isetitem(df.columns.get_loc(time), truncated[time]) return df def fetchone(