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

Should GroupBy.transform exclude nuisance columns? #1364

Closed
wesm opened this issue May 31, 2012 · 0 comments
Closed

Should GroupBy.transform exclude nuisance columns? #1364

wesm opened this issue May 31, 2012 · 0 comments

Comments

@wesm
Copy link
Member

wesm commented May 31, 2012

In [46]: print df; df.groupby('key1').transform(lambda x: x.mean())
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/book_scripts/notebooks/<ipython-input-46-656cf72f4323> in <module>()
      1 print df
----> 2 df.groupby('key1').transform(lambda x: x.mean())

/home/wesm/code/pandas/pandas/core/groupby.pyc in transform(self, func, *args, **kwargs)
   1639                     group.T.values[:] = res
   1640                 else:
-> 1641                     group.values[:] = res
   1642 
   1643                 applied.append(group)

ValueError: operands could not be broadcast together with shapes (3,4) (2) 

      data1     data2 key1 key2
0  0.984916  0.904550    a  one
1 -1.879638  0.585887    a  two
2  0.457879 -0.721776    b  one
3  1.585887  0.050336    b  two
4 -0.701547  0.525808    a  one
@ghost ghost assigned wesm May 31, 2012
@wesm wesm closed this as completed in f62f571 Jun 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant