Skip to content

BUG: Fix failing MacPython 32bit wheels for groupby rolling #34423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pandas/core/window/indexers.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,18 @@ def get_window_bounds(
start, end = indexer.get_window_bounds(
len(indicies), min_periods, center, closed
)
start = start.astype(np.int64)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should np.intp

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm this is ok

end = end.astype(np.int64)
# Cannot use groupby_indicies as they might not be monotonic with the object
# we're rolling over
window_indicies = np.arange(
window_indicies_start,
window_indicies_start + len(indicies),
dtype=np.int64,
window_indicies_start, window_indicies_start + len(indicies),
)
window_indicies_start += len(indicies)
# Extend as we'll be slicing window like [start, end)
window_indicies = np.append(window_indicies, [window_indicies[-1] + 1])
window_indicies = np.append(
window_indicies, [window_indicies[-1] + 1]
).astype(np.int64)
start_arrays.append(window_indicies.take(start))
end_arrays.append(window_indicies.take(end))
start = np.concatenate(start_arrays)
Expand Down
5 changes: 4 additions & 1 deletion pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2228,7 +2228,10 @@ def _create_blocks(self, obj: FrameOrSeries):
"""
# Ensure the object we're rolling over is monotonically sorted relative
# to the groups
obj = obj.take(np.concatenate(list(self._groupby.grouper.indices.values())))
groupby_order = np.concatenate(
list(self._groupby.grouper.indices.values())
).astype(np.int64)
obj = obj.take(groupby_order)
return super()._create_blocks(obj)

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