Here is my dataset:
-
COL_1 COL_2 COL_2 COL_4 COL_4 COL_8 COL_9 A col2 col3 col4 col5 B col2 col3 col4 col5 C col2 col3 col4 col5
I need to move pairs of columns (COL_2 , COL_3 and then COL_4, COL_5) to COL_8 and COL_9 and copy the content of the 1st column (COL_1) as well as put the names of columns (COL_2, COL_4) to the other column (COL_10) this way:
-
COL_1 COL_8 COL_9 COL10 A col2 col3 COL_2 B col2 col3 COL_2 C col2 col3 COL_2 A col4 col5 COL_4 B col4 col5 COL_4 C col4 col5 COL_4
Please note that some of column names in initial dataset are identical. How can I do it using Python?