I have an 11 column Pandas DataFrame, df
Name aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk
I want to rename the columns so that the new header is
Name type_1 type_2 type_3 type_4 type_5 expt_1 expt_2 expt_3 expt_4 expt_5
I can use df.rename
but I will have to manually type in the new names.
Can you tell me how I can change the names iteratively to type_*
or expt_*
? where
* = half the number of columns excluding the first one (Name)
I ask this because I want to generalize this naming system to a large table with 1000 columns.