0

I need to stack the repeating column values under single column. For example, if a,b and c are repeating columns with respective values

product,a, b, c, a, b, c 

X, 1, 3, 2, 2, 5, 1

Expected result should look like

product, a, b, c

X, 1, 3, 2

X, 2, 5, 1

Please be informed that before these columns I have "Products" and I need to keep as it repeating for as many new rows added.

I have tried melt in python 3 but it doesn't solve

run-out
  • 3,114
  • 1
  • 9
  • 25
  • Possible duplicate of [Pandas long to wide reshape, by two variables](https://stackoverflow.com/questions/22798934/pandas-long-to-wide-reshape-by-two-variables) – aparpara May 08 '19 at 07:43
  • No duplicates in the data – Pritam Patnaik May 08 '19 at 08:05
  • is product the name of your table? do you have a unique identifier there such as a day ? do you have anything to tell me how X first row differs from X second row? – Herc01 May 08 '19 at 12:29
  • Product is a column in the dataframe, If you see the example given, X is a product with a,b,c values as 1,3,2 and 2,5,1, which are aligned in a single row, but I am expecting the output to be as shown above. Your help would be appreicated @Herc01 – Pritam Patnaik May 09 '19 at 05:43

0 Answers0