Python Forum
Help to control pandas.melt function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help to control pandas.melt function
I’m using pandas to processing my raw data.
I have raw data like this:

I want to convert some columns to row using pd.melt like this:

But, I don’t know how to move USL & LSL transpose to 2 columns.
Can anyone help me.
Thanks so much!!!
My file:
Larz60+ write Jun-17-2023, 02:34 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Noone likes to open links.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas replace function not working on datafram with floats bcrypto 1 3,065 Apr-12-2021, 08:59 PM
Last Post: bcrypto
  What is the mechanism of numpy function returning pandas object? Ibaraki 2 2,654 Apr-04-2020, 10:57 PM
Last Post: Ibaraki
  how to apply user defined function to Pandas DataFrame evelynow 3 7,816 Aug-20-2019, 11:35 PM
Last Post: scidam
  Pandas melt only on one variable (leaving other in long format) amyd 0 2,033 May-08-2019, 12:10 PM
Last Post: amyd
  Function question using Pandas smw10c 7 7,310 Feb-12-2019, 06:52 PM
Last Post: Nathandsn
  Melt or Slice Grin 0 2,260 Jun-24-2018, 06:02 PM
Last Post: Grin

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020