'Why does np.bitwise_and() returns a boolean series , when two unalligned int64 series are passed to it as argument
The two unaligned series below are:
sa = pd.Series([1, 0, 1], index=list("ABC"))
sb = pd.Series([0, 0, 1], index=list("ACB"))
Now when np.bitwise_and(sa, sb) is executed it returns a boolean series as given below:
A False
B False
C False
dtype: bool
The answer should be series of integers ? why this operation is returning boolean series?
How ever if the labels of both series are aligned then the answer is also an integer series
sa = pd.Series([1, 0, 1], index=list("ABC"))
sb = pd.Series([0, 0, 1], index=list("ABC"))
np.bitwise_and(sa, sb) results in :
A 0
B 0
C 1
dtype: int64
Please make it clear
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
