1
我有两个系列,其具有等于这样的格式:两个系列的布尔比较对象
0 False
1 False
2 False
3 True
4 True
Name: foo, dtype: bool
0 True
1 False
2 False
3 True
4 True
Name: bar, dtype: bool
我想创建这些所产生的布尔比较新的系列。事情是这样的:
result = foo and bar
>>> print result
0 False
1 False
2 False
3 True
4 True
Name: result, dtype: bool
使用明显result = foo and bar
只会导致以下错误:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
我看着那些功能,但也似乎做什么,我想。
我该如何做一个系列的元素到元素布尔比较导致一个新的系列?