0

Example,

This is checking for true conditions to create a new boolean series to add to a dataframe:

new_bool_series = bool_series1 & bool_series2 & bool_series3
df['column3'] = new_series

This works because the logic is straight forward. the new_series variable can turn out to be true or false but I never figured out how to include a False condition:

new_series = not series1 & series2 & series3

...doesn't work...ambiguous error, and has logic problems.

new_series = series1 == False & series2 & series3

...also doesn't work and produces an error. So I am trying to figure out the right code to generate the column 3 result, if column1 is False and column2 is True, then column 3 is True.

column1, column2, result
False, True, True
True, True, False

0 Answers0