I have a dataset, df, where I would like to combine or sum the values in 2 specific columns to one column
Data
id name1 name2 status
aa 1 0 y
bb 2 2 n
cc 0 1 y
Desired
id name status
aa 1 y
bb 4 n
cc 1 y
Doing
df['name'] = df[['name1', 'name2']].agg(axis = 1)
I am running this script, however, I think I am missing a key syntax. Any suggestion is appreciated.