Skip to content
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

REGR: Resampler.aggregate fails when used with column selection #43410

Merged
merged 6 commits into from
Sep 6, 2021

Conversation

rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented Sep 5, 2021

The method resample._GroupByMixin._gotitem calls

new_rs = type(self)(
    subset, groupby=groupby, parent=self, selection=selection, **kwargs
)

The selection (which ends up in kwargs in __init__) was being ignored.

@rhshadrach rhshadrach added Bug Regression Functionality that used to work in a prior pandas version Resample resample method labels Sep 5, 2021
@rhshadrach rhshadrach added this to the 1.3.3 milestone Sep 5, 2021
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

Thanks @rhshadrach

# GH 42905
ts = Timestamp("2021-02-28 00:00:00")
df = DataFrame({"class": ["beta"], "value": [69], "date": [ts]})
result = (
Copy link
Member

Choose a reason for hiding this comment

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

nit. can you make the result assignment just the op under test.

.resample("M")["value"]
.agg(["sum", "size"])
)
index = pd.MultiIndex.from_tuples([("beta", ts)], names=["class", "date"])
Copy link
Member

Choose a reason for hiding this comment

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

another nit. index -> expected_index or even okay to inline with the df creation as black generally tends to do a good job of making things readable

@rhshadrach
Copy link
Member Author

Thanks @simonjayhawkins - comments addressed.

pandas/core/resample.py Show resolved Hide resolved
@jreback jreback merged commit c7d98e1 into pandas-dev:master Sep 6, 2021
@jreback
Copy link
Contributor

jreback commented Sep 6, 2021

thanks @rhshadrach

@jreback
Copy link
Contributor

jreback commented Sep 6, 2021

@meeseeksdev backport 1.3.x

@lumberbot-app

This comment has been minimized.

@jreback
Copy link
Contributor

jreback commented Sep 6, 2021

@rhshadrach can you put up the manual backport :-<

@lumberbot-app

This comment has been minimized.

@simonjayhawkins
Copy link
Member

@meeseeksdev backport 1.3.x

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Sep 7, 2021
jreback pushed a commit that referenced this pull request Sep 7, 2021
…lumn selection (#43444)

Co-authored-by: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com>
@rhshadrach rhshadrach deleted the groupby_agg_regr branch September 7, 2021 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Regression Functionality that used to work in a prior pandas version Resample resample method
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: RecursionError using agg on a resampled SeriesGroupBy
3 participants