I have two columns which I stored sets in my dataframe.
I want to perform set union on the two columns using fast vectorized operation
df['union'] = df.set1 | df.set2
but the error TypeError: unsupported operand type(s) for |: 'set' and 'bool'
is preventing me from doing so as I have type np.nan
in both columns.
Is there a good solution to overcome this?
See Question&Answers more detail:os