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

FIX: resample to single group with custom function #4494

Merged
merged 1 commit into from
Sep 25, 2013

Conversation

Komnomnomnom
Copy link
Contributor

Using master code, when re-sampling to a frequency that would result in a single group the use of custom aggregation functions do not work as expected. The included changes fix this, and should fix #3849 too.

In [17]: import pandas as pd

In [18]: import numpy as np

In [19]: mysum = lambda x: x.sum()

In [20]: rng = pd.date_range('2000-1-1', '2000-1-10', freq='D')

In [21]: ts = pd.Series(np.random.randn(len(rng)), index=rng)

In [22]: ts.resample('M', how='sum')
Out[22]: 
2000-01-31    0.985236
Freq: M, dtype: float64

In [23]: ts.resample('M', how=mysum)
Out[23]: 
2000-01-31    0
Freq: M, dtype: float64

@jreback
Copy link
Contributor

jreback commented Aug 23, 2013

@jtratner take a look?

@jreback
Copy link
Contributor

jreback commented Sep 24, 2013

@Komnomnomnom can you add a release notes.....?

and add in tests for #3849
much appreciated

@Komnomnomnom
Copy link
Contributor Author

Done and done (I presume you meant #3849 ... ?)

@jreback
Copy link
Contributor

jreback commented Sep 25, 2013

yep..that's what I meant!

jreback added a commit that referenced this pull request Sep 25, 2013
FIX: resample to single group with custom function
@jreback jreback merged commit 86f81b4 into pandas-dev:master Sep 25, 2013
@Komnomnomnom Komnomnomnom deleted the resample-sing-grp-bug branch September 25, 2013 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: resample in single group case not using how passed function
2 participants