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

Series.resample fails with how='nunique' #10914

Closed
jcrist opened this issue Aug 27, 2015 · 4 comments · Fixed by #10918
Closed

Series.resample fails with how='nunique' #10914

jcrist opened this issue Aug 27, 2015 · 4 comments · Fixed by #10918
Labels
Regression Functionality that used to work in a prior pandas version Resample resample method
Milestone

Comments

@jcrist
Copy link
Contributor

jcrist commented Aug 27, 2015

Works on 0.16.2, fails on git master.

import pandas as pd
import numpy as np

index = pd.date_range(start='20120102', periods=24*60*3, freq='T').values
index = index[::2]
s = pd.Series(np.arange(len(index), dtype='f8'), index=pd.Index(index))
expected = s.resample('30T', how='nunique')

Traceback:

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    expected = s.resample('30T', how='nunique')
  File "/Users/jcrist/Code/pandas/pandas/core/generic.py", line 3368, in resample
    return sampler.resample(self).__finalize__(self)
  File "/Users/jcrist/Code/pandas/pandas/tseries/resample.py", line 82, in resample
    rs = self._resample_timestamps()
  File "/Users/jcrist/Code/pandas/pandas/tseries/resample.py", line 287, in _resample_timestamps
    result = grouped.aggregate(self._agg_method)
  File "/Users/jcrist/Code/pandas/pandas/core/groupby.py", line 2339, in aggregate
    return getattr(self, func_or_funcs)(*args, **kwargs)
  File "/Users/jcrist/Code/pandas/pandas/core/groupby.py", line 2564, in nunique
    sorter = np.lexsort((val, ids))
ValueError: all keys need to be the same shape
@jreback
Copy link
Contributor

jreback commented Aug 27, 2015

this was just changed yesterday: #10909

@jreback
Copy link
Contributor

jreback commented Aug 27, 2015

cc @behzadnouri can u have a look

@jreback jreback added Regression Functionality that used to work in a prior pandas version Resample resample method labels Aug 27, 2015
@jreback jreback added this to the 0.17.0 milestone Aug 27, 2015
@behzadnouri
Copy link
Contributor

For the record the bug was in BinGrouper.group_info not in #10909

@jreback
Copy link
Contributor

jreback commented Aug 28, 2015

@jcrist

fixed in master, fyi you don't need to work so hard to create things

this is the same

In [12]: index = pd.date_range(start='20120102', periods=24*60*3, freq='2T')

In [13]: s = pd.Series(np.arange(len(index)), index=index)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version Resample resample method
Projects
None yet
3 participants