Skip to content

ENH: Add optional argument keep_index to dataframe melt method (merged master onto old PR) #28859

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

Closed
wants to merge 3 commits into from

Conversation

smsaladi
Copy link
Contributor

@smsaladi smsaladi commented Oct 8, 2019

This PR merges master onto @NiklasKeck's PR branch (#17440) to add an optional argument to keep_index to pd.melt. There is quite a bit of discussion between the following 2 PRs and issues:

Index gets lost when DataFrame melt method is used #17440
ENH: Add optional argument keep_index to dataframe melt method #17459
Melt enhance #17677

Please let me know if additional things need to be done to complete this PR


Setting keep_index to True will reuse the original DataFrame index +
names of melted columns as additional level. closes issue #17440

(cherry picked from commit 0c64bf0)

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

NiklasKeck and others added 3 commits October 8, 2019 14:31
Setting keep_index to True will reuse the original DataFrame index +
names of melted columns as additional level. closes issue #17440

(cherry picked from commit 0c64bf0)
@smsaladi
Copy link
Contributor Author

smsaladi commented Oct 9, 2019

Based on the decrease in code coverage, I assume tests will need to be added here:

I'm unfamiliar with how the tests are actually structured, so if someone could provide some direction, I could put together a test for review.

@WillAyd
Copy link
Member

WillAyd commented Oct 10, 2019

Yep tests are pretty much the most important part of any PR. If you can add someone can take a look

@WillAyd WillAyd added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label Oct 10, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

@smsaladi can you add a test?

@jbrockmendel
Copy link
Member

@smsaladi this needs tests for the new behavior

@WillAyd
Copy link
Member

WillAyd commented Dec 9, 2019

Closing as I think this is stale, but @smsaladi feel free to ping if you want to pick back up and address comments

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

Successfully merging this pull request may close these issues.

4 participants