I have a data frame with around 10k Observation and few features. Manually in excel file I can create a new column based on given data i.e.
= IF(A = 0, 1, B)
where A, B are basically Column name.
Output of above formula would be appended on new column i.e. C.
I have used below Python code :
C = []
for x in df['A']:
if x == 0:
C.append(1)
else:
C.append(df['B'])
But the above output is giving me "unhashable type: 'Series'" Error.
Anyway to correct the above code