Skip to content

Commit cb244ed

Browse files
mroeschkeMatt Roeschke
and
Matt Roeschke
authored
BUG: Fix failing MacPython 32 wheels for rolling groupby (#34423)
Co-authored-by: Matt Roeschke <[email protected]>
1 parent cc63484 commit cb244ed

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

pandas/core/window/indexers.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,18 @@ def get_window_bounds(
218218
start, end = indexer.get_window_bounds(
219219
len(indicies), min_periods, center, closed
220220
)
221+
start = start.astype(np.int64)
222+
end = end.astype(np.int64)
221223
# Cannot use groupby_indicies as they might not be monotonic with the object
222224
# we're rolling over
223225
window_indicies = np.arange(
224-
window_indicies_start,
225-
window_indicies_start + len(indicies),
226-
dtype=np.int64,
226+
window_indicies_start, window_indicies_start + len(indicies),
227227
)
228228
window_indicies_start += len(indicies)
229229
# Extend as we'll be slicing window like [start, end)
230-
window_indicies = np.append(window_indicies, [window_indicies[-1] + 1])
230+
window_indicies = np.append(
231+
window_indicies, [window_indicies[-1] + 1]
232+
).astype(np.int64)
231233
start_arrays.append(window_indicies.take(start))
232234
end_arrays.append(window_indicies.take(end))
233235
start = np.concatenate(start_arrays)

pandas/core/window/rolling.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,10 @@ def _create_blocks(self, obj: FrameOrSeries):
22282228
"""
22292229
# Ensure the object we're rolling over is monotonically sorted relative
22302230
# to the groups
2231-
obj = obj.take(np.concatenate(list(self._groupby.grouper.indices.values())))
2231+
groupby_order = np.concatenate(
2232+
list(self._groupby.grouper.indices.values())
2233+
).astype(np.int64)
2234+
obj = obj.take(groupby_order)
22322235
return super()._create_blocks(obj)
22332236

22342237
def _get_cython_func_type(self, func: str) -> Callable:

0 commit comments

Comments
 (0)