Given the following df:
df_test = pd.DataFrame({'0' : ['find expert model','NR','R','NR'],
'1' : ["news recommend", "NR" ,"NR", "NR"],
'2' : ["a recommend", "R" , "NR", "NR"],
'3' : ["a web recommend", "R", "NR", "R"]})
df_test
0 1 2 3
0 find expert model news recommend a recommend a web recommend
1 NR NR R R
2 R NR NR NR
3 NR NR NR R
I am trying to obtain this form of the df:
0 1 2 3
0 NR NR a recommend a web recommend
1 find expert model NR NR NR
2 NR NR NR a web recommend
The goal here is to replace every string R in a certain cell with the string from the first row of the distinct column. The replacing process should begin at the row with index 1.
Any ideas? Thanks in advance!