【发布时间】:2016-11-20 13:15:59
【问题描述】:
我有两列存储在我的数据框中。
我想使用快速向量化操作对两列执行集合并集
df['union'] = df.set1 | df.set2
但错误TypeError: unsupported operand type(s) for |: 'set' and 'bool' 阻止我这样做,因为我在两列中都输入了np.nan。
有没有好的解决方案来克服这个问题?
【问题讨论】:
标签: python python-3.x numpy pandas vectorization