API: Groupby using a TimeGrouper missing methods · Issue #3881 · pandas-dev/pandas (original) (raw)
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'