'Stacking columns to rows

I have a df with columns names S. no., a, b, c, 1, 2, 3. I want new df with S.no. where below each S. no. it will show 1 , 2, 3 and columns will be a, b, c. The values of a, b, c will be repeated thrice for each serial number against 1, 2, 3. I am basically changing 1, 2, 3 columns to rows under each serial number.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source