-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Allow the groupby by param to handle columns and index levels (GH5677) #14432
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
Changes from all commits
eb1e63f
355d709
b050aca
5f93ddd
5325ee6
b68af16
98af4d7
2d35461
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,20 @@ Other enhancements | |
^^^^^^^^^^^^^^^^^^ | ||
|
||
- ``pd.read_excel`` now preserves sheet order when using ``sheetname=None`` (:issue:`9930`) | ||
- Strings passed to ``DataFrame.groupby()`` as the ``by`` parameter may now reference either column names or index level names (:issue:`5677`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will need an example here. put the same one in groupby.rst (make also need to add to the groupby doc-string) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jreback Example added here and in groupby.rst. I didn't add anything to the groupby-docstring yet as I wasn't quite sure where it would fit in (there are only two examples there right now). Let me know what you think. |
||
|
||
.. ipython:: python | ||
|
||
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], | ||
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']] | ||
|
||
index = pd.MultiIndex.from_arrays(arrays, names=['first', 'second']) | ||
|
||
df = pd.DataFrame({'A': [1, 1, 1, 1, 2, 2, 3, 3], | ||
'B': np.arange(8)}, | ||
index=index) | ||
|
||
df.groupby(['second', 'A']).sum() | ||
|
||
|
||
.. _whatsnew_0200.api_breaking: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versionadded tag
i would also make this into a note section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback I wasn't quite sure how to handle versionadded and keep the description in the list. I left the description in the list (without ambiguity explanation) and added a note section below with versionadded tag that describes the change and the ambiguity behavior.