Skip to content

REF: move towards making _apply_blockwise actually block-wise #35730

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 11 commits into from
Aug 23, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'master' of https://github.com/pandas-dev/pandas into re…
…set-dropped-locs-5
  • Loading branch information
jbrockmendel committed Aug 21, 2020
commit 1d786f230ecb43fb1dca5f30aa6f2296e5d10364
12 changes: 9 additions & 3 deletions pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from pandas._libs.tslibs import BaseOffset, to_offset
import pandas._libs.window.aggregations as window_aggregations
from pandas._typing import ArrayLike, Axis, FrameOrSeriesUnion, Scalar
from pandas._typing import ArrayLike, Axis, FrameOrSeriesUnion, Label
from pandas.compat._optional import import_optional_dependency
from pandas.compat.numpy import function as nv
from pandas.util._decorators import Appender, Substitution, cache_readonly, doc
Expand Down Expand Up @@ -394,7 +394,7 @@ def _wrap_result(self, result, block=None, obj=None):
return type(obj)(result, index=index, columns=block.columns)
return result

def _wrap_results(self, results, blocks, obj, exclude=None) -> FrameOrSeriesUnion:
def _wrap_results(self, results, obj, skipped: List[int]) -> FrameOrSeriesUnion:
"""
Wrap the results.

Expand All @@ -413,6 +413,13 @@ def _wrap_results(self, results, blocks, obj, exclude=None) -> FrameOrSeriesUnio
assert len(results) == 1
return Series(results[0], index=obj.index, name=obj.name)

exclude: List[Label] = []
orig_blocks = list(obj._to_dict_of_blocks(copy=False).values())
for i in skipped:
exclude.extend(orig_blocks[i].columns)

kept_blocks = [blk for i, blk in enumerate(orig_blocks) if i not in skipped]

final = []
for result, block in zip(results, kept_blocks):

Expand Down Expand Up @@ -532,7 +539,6 @@ def _apply_blockwise(

except (TypeError, NotImplementedError):
skipped.append(i)
exclude.extend(b.columns)
continue

result = homogeneous_func(values)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.