Skip to content

ENH: #3335 Pivot table support for setting name of margins column. #11581

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

Conversation

lexual
Copy link
Contributor

@lexual lexual commented Nov 12, 2015

closes #3335.

Adds margin_column parameter to pivot_table so that user can set it to
something other than 'All'.
Raises ValueError exception if there is a conflict between the value of
margin_column and one of the other values appearing in the indices of
the pivot table.

take into account notes from closed pull request: #10296

exception_message = 'Conflicting name for margins'
for level in table.index.names:
if margins_name in table.index.get_level_values(level):
raise ValueError(exception_message)
Copy link
Contributor

Choose a reason for hiding this comment

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

use the margins_name itself in the error message

@jreback jreback added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Nov 12, 2015
@jreback
Copy link
Contributor

jreback commented Nov 13, 2015

pls also add a whatsnew note (API changes)

@lexual lexual force-pushed the issue_3335_pivot_handle_all_for_margins branch 4 times, most recently from c56d00f to ac97c7e Compare November 14, 2015 07:21
@lexual
Copy link
Contributor Author

lexual commented Nov 14, 2015

done

@jreback
Copy link
Contributor

jreback commented Nov 14, 2015

you have to do message {0}".format('blah') so 2.6 doesn't complain

…column.

ref pandas-dev#3335.

Adds margin_name parameter to pivot_table so that user can set it to
something other than 'All'.
Raises ValueError exception if there is a conflict between the value of
margin_column and one of the other values appearing in the indices of
the pivot table.
@lexual lexual force-pushed the issue_3335_pivot_handle_all_for_margins branch from ac97c7e to 1ca006c Compare November 15, 2015 00:57
@lexual
Copy link
Contributor Author

lexual commented Nov 15, 2015

.format() change made, waiting on Travis.

@lexual
Copy link
Contributor Author

lexual commented Nov 15, 2015

Travis tests green ;)

@jreback jreback added this to the 0.17.1 milestone Nov 15, 2015
jreback added a commit that referenced this pull request Nov 15, 2015
…_margins

ENH: #3335 Pivot table support for setting name of margins column.
@jreback jreback merged commit 10fe47e into pandas-dev:master Nov 15, 2015
@jreback
Copy link
Contributor

jreback commented Nov 15, 2015

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test/fix case where use of "All" causes problems in pivot_table with margins=True
2 participants