I want to create a new column in my pandas dataframe based on values in already existing columns. The input of the new column should be boolean. At the moment I am trying the following:
import pandas as pd df_edit = pd.DataFrame({'Included': [False, False, True, False], 'Update Check': [True, True, True, True], 'duplicate_fname': [True, False, False, False], 'duplicate_targetfname': [False, False, False, False]}) df_edit['test'] = df_edit['Included'] == False & df_edit['Update Check'] == True & (df_edit['duplicate_fname'] == True | df_edit['duplicate_targetfname'] == True) When I try to do it like this I get a ValueError stating the following:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), >a.item(), a.any() or a.all().
Is there another way to do this?
My expected output would be a column that consists of the following values:
True, False, False, False