From 8aa9653dc02df870d58d9626b29271d6edff9a99 Mon Sep 17 00:00:00 2001 From: Brock Date: Fri, 8 Dec 2023 19:36:40 -0800 Subject: [PATCH] troubleshoot 32bit builds --- pandas/core/arrays/datetimelike.py | 8 ++++---- pandas/core/arrays/period.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index 3b87b28170b91..b4d9964c10ebd 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -1069,7 +1069,7 @@ def _add_datetimelike_scalar(self, other) -> DatetimeArray: self = cast("TimedeltaArray", self) other_i8, o_mask = self._get_i8_values_and_mask(other) - result = add_overflowsafe(self.asi8, np.asarray(other_i8)) + result = add_overflowsafe(self.asi8, np.asarray(other_i8, dtype="i8")) res_values = result.view(f"M8[{self.unit}]") dtype = tz_to_dtype(tz=other.tz, unit=self.unit) @@ -1132,7 +1132,7 @@ def _sub_datetimelike(self, other: Timestamp | DatetimeArray) -> TimedeltaArray: raise type(err)(new_message) from err other_i8, o_mask = self._get_i8_values_and_mask(other) - res_values = add_overflowsafe(self.asi8, np.asarray(-other_i8)) + res_values = add_overflowsafe(self.asi8, np.asarray(-other_i8, dtype="i8")) res_m8 = res_values.view(f"timedelta64[{self.unit}]") new_freq = self._get_arithmetic_result_freq(other) @@ -1198,7 +1198,7 @@ def _add_timedeltalike(self, other: Timedelta | TimedeltaArray): self = cast("DatetimeArray | TimedeltaArray", self) other_i8, o_mask = self._get_i8_values_and_mask(other) - new_values = add_overflowsafe(self.asi8, np.asarray(other_i8)) + new_values = add_overflowsafe(self.asi8, np.asarray(other_i8, dtype="i8")) res_values = new_values.view(self._ndarray.dtype) new_freq = self._get_arithmetic_result_freq(other) @@ -1266,7 +1266,7 @@ def _sub_periodlike(self, other: Period | PeriodArray) -> npt.NDArray[np.object_ self._check_compatible_with(other) other_i8, o_mask = self._get_i8_values_and_mask(other) - new_i8_data = add_overflowsafe(self.asi8, np.asarray(-other_i8)) + new_i8_data = add_overflowsafe(self.asi8, np.asarray(-other_i8, dtype="i8")) new_data = np.array([self.freq.base * x for x in new_i8_data]) if o_mask is None: diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index 4a16d0c4cd958..26eef379909c3 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -847,7 +847,7 @@ def _addsub_int_array_or_scalar( assert op in [operator.add, operator.sub] if op is operator.sub: other = -other - res_values = add_overflowsafe(self.asi8, np.asarray(other)) + res_values = add_overflowsafe(self.asi8, np.asarray(other, dtype="i8")) return type(self)(res_values, dtype=self.dtype) def _add_offset(self, other: BaseOffset):