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

ENH: Implement sem for Rolling and Expanding #37043

Merged
merged 4 commits into from
Oct 12, 2020
Merged

Conversation

phofl
Copy link
Member

@phofl phofl commented Oct 10, 2020

I added sem to the Rolling and Expanding API as mentioned in the issue linked above.

@jreback jreback added the Window rolling, ewma, expanding label Oct 10, 2020
@mroeschke
Copy link
Member

Thanks. Could you also add tests for groupby().rolling().sem() and groupby().expanding().sem()?

@phofl
Copy link
Member Author

phofl commented Oct 11, 2020

Done, count also counts for the grouping column. Is this the expected behavior?

@mroeschke
Copy link
Member

Could you give a small example for the count behavior?

@phofl
Copy link
Member Author

phofl commented Oct 11, 2020

The snippet

df = pd.DataFrame([["a", 1], ["a", 2], ["b", 1], ["b", 2], ["b", 3]], columns=["a", "b"])
result = df.groupby("a").rolling(2, min_periods=1).count()
print(result)

returns

       a    b
a            
a 0  1.0  1.0
  1  2.0  2.0
b 2  1.0  1.0
  3  2.0  2.0
  4  2.0  2.0

I would not have expected a to be a column and part of the index.

@mroeschke
Copy link
Member

Thanks, I think that's a known bug #32262

@jreback jreback added this to the 1.2 milestone Oct 12, 2020
@jreback jreback merged commit 773b9fb into pandas-dev:master Oct 12, 2020
@jreback
Copy link
Contributor

jreback commented Oct 12, 2020

thanks @phofl very nice

@phofl phofl deleted the 26476 branch October 12, 2020 19:01
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Oct 26, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Window rolling, ewma, expanding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standard Error of the Mean Unavailable in RollingGroupby
3 participants