Skip to content

Add example section to groupby.rst and one example #6304

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

Merged
merged 2 commits into from
Feb 15, 2014

Conversation

mazieres
Copy link
Contributor

@mazieres mazieres commented Feb 8, 2014

following this question on StackOverFlow and this issue.
I opened an "Examples" section in the doc of groupby() and add an example about how a way to regroup columns of a DataFrame according to their sum, and to sum the aggregated ones.

closes #6288

.. ipython::

In [2]: dat = {'a':[1,0,0], 'b':[0,1,0], 'c':[1,0,0], 'd':[2,3,4]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be actual code, not a past of an ipython session (it WILL generate an ipython session as it goes)

e.g.

 df = DataFrame(.....)
df.groupby(df.sum(), axis=1).sum()

is all that's needed

and needs to be

.. ipython:: python

jreback added a commit that referenced this pull request Feb 15, 2014
Add example section to groupby.rst and one example
@jreback jreback merged commit cbe7d74 into pandas-dev:master Feb 15, 2014
@jreback
Copy link
Contributor

jreback commented Feb 15, 2014

thanks!!

if you want to put some more examples, you love to expand this section!

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

Successfully merging this pull request may close these issues.

[Docs] GroupsBy Example: Group by value of sum of columns
2 participants