-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
ENH melt uses column name if available #4144
Conversation
isn't this already in with #3649, or this is just a cleanup of that? |
oh i c, you name is more 'automatic'...nice! |
@hayd there is a release notes/whatsnew associated with 3649, why don't you add on to it with this change? |
I was just pondering whether I needed to bother :) will do |
As an aside, wonder if melt should work with multiindexes... |
@@ -651,6 +652,9 @@ def melt(frame, id_vars=None, value_vars=None, | |||
else: | |||
frame = frame.copy() | |||
|
|||
if var_name is None: | |||
var_name = frame.columns.name if frame.columns.name is not None else 'variable' |
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.
u could do frame.columns.name or 'variable'
too :)
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.
...but just in case they had named their column False(y) :)
merge? (Have another WIP for MultiIndexes) |
look good |
ENH melt uses column name if available
Currently melt allows you to manually specify the val_name and var_name, this changes the default behaviour to grab the column name if one is available.