Skip to content

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

Closed
@jcrist

Description

@jcrist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    RegressionFunctionality that used to work in a prior pandas versionResampleresample method

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions