I have a dataframe 6k columns wide, of the format:
import pandas as pd
df = pd.DataFrame([('jan 1 2000','a','b','c',1,2,3,'aa','bb','cc'), ('jan 2 2000','d', 'e', 'f', 4, 5, 6, 'dd', 'ee', 'ff')],
columns=['date','a_1', 'a_2', 'a_3','b_1', 'b_2', 'b_3','c_1', 'c_2', 'c_3'])
df
date a_1 a_2 a_3 b_1 b_2 b_3 c_1 c_2 c_3
0 jan 1 2000 a b c 1 2 3 aa bb cc
1 jan 2 2000 d e f 4 5 6 dd ee ff
I want:
I have looked at: Pandas Melt several groups of columns into multiple target columns by name and Pandas: Multiple columns into one column but am unable to form a correct solution.
Any suggestions are appreciated