Issue regarding usage of np.bitwise_and on pandas Series

23 views
Skip to first unread message

Manprit Singh

unread,
Apr 11, 2022, 6:59:02 PMApr 11
to PyData
I have two Series

sa = pd.Series([1, 0, 1], index=list("ABC"))
sb = pd.Series([0, 0, 1], index=list("ABC"))

np.bitwise_and(sa, sb) gives the right answer as below:
A 0
B 0
C 1
dtype: int 64

When when using unaligned series as below:
sa = pd.Series([1, 0, 1], index=list("ABC"))
sb = pd.Series([0, 0, 1], index=list("ACB"))

np.bitwise_and(sa, sb), gives the result in terms of boolean values as below :

A False
B False
C False
dtype : bool

How can a bitwise_ and, can give the result in boolean when series are not alligned .
KIndly help

Reply all
Reply to author
Forward
0 new messages