Skip to content

Conversation

@rbavishi
Copy link

Example Input DataFrame -

import pandas as pd x = pd.DataFrame([[0, 1], [2, 3]], columns=[list('AB'), list('CD')]) """ A B C D 0 0 1 1 2 3 """ x.melt(col_level=1, id_vars=['C'], value_vars=['D']) 

Current Output -

KeyError: 'C' 

Desired Output -

 C variable value 0 0 D 1 1 2 D 3 
@pep8speaks
Copy link

pep8speaks commented Apr 10, 2018

Hello @rbavishi! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on April 10, 2018 at 05:37 Hours UTC
@rbavishi rbavishi force-pushed the bugfix-melt-column-multi-index branch from 3181b87 to 116c6b4 Compare April 10, 2018 05:37
@codecov
Copy link

codecov bot commented Apr 10, 2018

Codecov Report

Merging #20646 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #20646 +/- ## ========================================== + Coverage 91.83% 91.84% +<.01%  ========================================== Files 153 153 Lines 49269 49271 +2 ========================================== + Hits 45247 45251 +4  + Misses 4022 4020 -2
Flag Coverage Δ
#multiple 90.22% <100%> (ø) ⬆️
#single 41.9% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/reshape/melt.py 97.39% <100%> (+0.04%) ⬆️
pandas/util/testing.py 84.59% <0%> (+0.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8f206d...116c6b4. Read the comment docs.

@gfyoung
Copy link
Member

gfyoung commented Apr 10, 2018

@rbavishi : Thanks for submitting this! A couple of things:

  1. Before submitting a PR, you should generally submit an issue. The content of your PR message would have been perfect for that!

  2. You'll need to add tests and an entry into our whatsnew file for 0.23.0

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

yeah this is probably broken. need some tests

@jreback jreback added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label Apr 11, 2018
@jreback
Copy link
Contributor

jreback commented Sep 25, 2018

closing as stale

@jreback jreback closed this Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MultiIndex Reshaping Concat, Merge/Join, Stack/Unstack, Explode

4 participants