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

API: Groupby using a TimeGrouper missing methods #3881

Closed
hayd opened this issue Jun 13, 2013 · 0 comments · Fixed by #6350
Closed

API: Groupby using a TimeGrouper missing methods #3881

hayd opened this issue Jun 13, 2013 · 0 comments · Fixed by #6350

Comments

@hayd
Copy link
Contributor

hayd commented Jun 13, 2013

Groupbys from TGs seem to have some useful functionality suppressed/hidden (?)

import datetime as DT

df = pd.DataFrame({
'Branch' : 'A A A A A B'.split(),
'Buyer': 'Carl Mark Carl Joe Joe Carl'.split(),
'Quantity': [1,3,5,8,9,3],
'Date' : [
DT.datetime(2013,1,1,13,0),
DT.datetime(2013,1,1,13,5),
DT.datetime(2013,10,1,20,0),
DT.datetime(2013,10,2,10,0),
DT.datetime(2013,12,2,12,0),                                      
DT.datetime(2013,12,2,14,0),
]})

df = df.set_index('Date', drop=False)
g = df.groupby(pd.TimeGrouper('6M'))

In [104]: g.gr
g.group_keys  g.grouper     g.groups

In [104]: g.groups
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-104-b207e9b2ead3> in <module>()
----> 1 g.groups

/Users/234BroadWalk/pandas/pandas/core/groupby.pyc in __getattr__(self, attr)
    235
    236         raise AttributeError("'%s' object has no attribute '%s'" %
--> 237                              (type(self).__name__, attr))
    238
    239     def __getitem__(self, key):

AttributeError: 'DataFrameGroupBy' object has no attribute 'groups'

cc #3794

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

Successfully merging a pull request may close this issue.

1 participant