In my pandas dataset, there are two columns (i.e. A and B) from which I wish to create a third column (C) that is "True" if either A or B is filled.
I have trialed the following code. However, after running this code, all the values in column C are "No" (indicating all cells in columns A and B are empty, however this is not the case).
df['C'] = C
C = []
for index, row in df.iterrows():
if df['a'].isnull() is False:
c.append("Yes")
elif df['b'].isnull() is False:
c.append("Yes")
else:
c.append("No")
I'm new to Python (and StackOverflow, too), so if anyone has any suggestions they will be most appreciated.
Thank you!