How to move some value in a column to different column on the same row [closed]

I’m trying to solve this problem but I couldn’t think of the logic, I wanted to move a value that has ‘NAM’ word in column B and replace it in column A that has ‘GMO’ word. Here’s the Dataframe

import pandas as pd

dataa = {'A':['NAM 1','NAM 2','NAM 3','GMO 12','NAM 5','GMO 2','NAM 7','NAM 8','GMO 32','GMO 22','NAM 11','NAM 12'],
         'B':['OBJ Y','OBJ N','OBJ Y','NAM 4','OBJ N','NAM 6','OBJ Y','OBJ Y','NAM 9','NAM 10','OBJ Y','OBJ N']
        }
df = pd.DataFrame(dataa)
df

    A         B
0   NAM 1   OBJ Y
1   NAM 2   OBJ N
2   NAM 3   OBJ Y
3   GMO 12  NAM 4
4   NAM 5   OBJ N
5   GMO 2   NAM 6
6   NAM 7   OBJ Y
7   NAM 8   OBJ Y
8   GMO 32  NAM 9
9   GMO 22  NAM 10
10  NAM 11  OBJ Y
11  NAM 12  OBJ N

enter image description here

Answer

You can use:

df['A'] = df['A'].where(~df['A'].str.startswith('GMO'), df['B'])