Skip to content

BUG: pd.Grouper specification broken for non-datetimelike when level specified #8866

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

Closed
jreback opened this issue Nov 20, 2014 · 1 comment · Fixed by #9008
Closed

BUG: pd.Grouper specification broken for non-datetimelike when level specified #8866

jreback opened this issue Nov 20, 2014 · 1 comment · Fixed by #9008
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Nov 20, 2014

In [15]: s = Series(np.arange(8),index=pd.MultiIndex.from_product([list('ab'),range(2),pd.date_range('20130101',periods=2)],names=['one','two','three']))

In [16]: s
Out[16]: 
one  two  three     
a    0    2013-01-01    0
          2013-01-02    1
     1    2013-01-01    2
          2013-01-02    3
b    0    2013-01-01    4
          2013-01-02    5
     1    2013-01-01    6
          2013-01-02    7
dtype: int64

# datetimelikes work
In [17]: s.groupby(pd.Grouper(level='three',freq='M')).sum()
Out[17]: 
three
2013-01-31    28
Freq: M, dtype: int64

# just specifying a level breaks
In [18]: s.groupby(pd.Grouper(level='one')).sum()
ValueError: No axis named None for object type <class 'pandas.core.series.Series'>
@springcoil
Copy link
Contributor

Hmm this seems a similar error to some other groupby errors I've looked at. I'll have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment