Hello i am trying to create new columns in a dataframe, existing columns one of the column values are matching with column name. and wanted check with other column values which is having any values or zero i tried below solution did not get my output
Python: pandas: match row value to column name/ key's value
my dataframe which is looking like
loc Var A T C G
3985 T 0 0 1 0
4491 G 10 0 0 25
4492 G 0 1 0 0
5265 A 35 10 0 1
7328 G 0 0 20 1
6927 A 1 0 0 0
output what i wanted
loc Var A T C G REF ALT
3985 T 0 0 1 0 0 1
4491 G 10 0 0 25 25 10
4492 G 0 1 0 0 0 1
5265 A 35 10 0 0 35 10
7328 G 0 0 20 1 1 20
6927 A 1 0 0 0 1 0
column "REF" columns match the values of "Var" and the ALT column which will search with the otherthan Var value, rest of the columns any one have value, i just wanted to match between four column(A,T, G, C) to get the other two column in dataframe
any suggestions? help