I have a dataframe like as shown below
df = pd.DataFrame({'person_id': [101,101,101,101],
'sourcename':['test1','test2','test3','test4'],
'Test':[np.nan,np.nan,'B5','B6']})
What I would like to do is copy non-na rows from Test column and paste it in corresponding row under sourcename column
When I tried the below, it makes the other rows of sourcename column as NA
df['sourcename'] = df.loc[df['Test'].notna()]['Test']
I expect my output to be like as shown below
