Skip to content

TimeGrouper on a DataFrame #3792

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
hayd opened this issue Jun 7, 2013 · 2 comments
Closed

TimeGrouper on a DataFrame #3792

hayd opened this issue Jun 7, 2013 · 2 comments

Comments

@hayd
Copy link
Contributor

hayd commented Jun 7, 2013

Am I using this incorrectly? (see so qustion).

In [1]: df = pd.DataFrame([[1, 2]], pd.date_range('20000101', periods=2))

In [2]: df
Out[2]:
            0  1
2000-01-01  1  2
2000-01-02  1  2

In [3]: g = df.groupby(pd.TimeGrouper('20D'))

Doesn't have some attributes, like group and friends:

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

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/groupby.pyc in __getattr__(self, attr)
    234
    235         raise AttributeError("'%s' object has no attribute '%s'" %
--> 236                              (type(self).__name__, attr))
    237
    238     def __getitem__(self, key):

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

In [5]: g.get_group(0)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-7ed4a1924eee> in <module>()
----> 1 g.get_group(0)

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/groupby.pyc in get_group(self, name, obj)
    270             obj = self.obj
    271
--> 272         inds = self.indices[name]
    273         return obj.take(inds, axis=self.axis)
    274

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/groupby.pyc in __getattr__(self, attr)
    234
    235         raise AttributeError("'%s' object has no attribute '%s'" %
--> 236                              (type(self).__name__, attr))
    237
    238     def __getitem__(self, key):

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

Related to #1057 ?

@jreback
Copy link
Contributor

jreback commented Jun 7, 2013

ha...just asked you in #3791

@hayd hayd closed this as completed Jun 7, 2013
@hayd
Copy link
Contributor Author

hayd commented Jun 7, 2013

(I should have posted that when I wrote it (!), yeah I'm really not sure what's going on here.)

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

No branches or pull requests

2 participants