Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Pandas: move values from one column to an appropriate column

$
0
0

My google-fu is failing me. I have a simple dataframe that looks like this:

SampleSubjectPersonPlaceThing
1-1Janet
1-1Boston
1-1Hat
1-2Chris
1-2Austin
1-2Scarf

I want the values in the subject column to move into their appropriate column so that I end up with something like this:

SampleSubjectPersonPlaceThing
1-1JanetJanetBostonHat
1-2ChrisChrisAustinScarf

I've looked at pivot and transpose, but those don't seem right.

Any ideas would be appreciated! :)


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>