__and__, __or__ in Series
This commit is contained in:
parent
da0bfcbcb1
commit
49cebecb88
@ -221,7 +221,23 @@ class Series(UserList):
|
|||||||
if isinstance(other, Series):
|
if isinstance(other, Series):
|
||||||
return Series([j != other[i] for i, j in enumerate(self)], "bool")
|
return Series([j != other[i] for i, j in enumerate(self)], "bool")
|
||||||
|
|
||||||
return Series([i == other for i in self.data], "bool")
|
return Series([i != other for i in self.data], "bool")
|
||||||
|
|
||||||
|
def __and__(self, other):
|
||||||
|
other = self._comparison_validator(other)
|
||||||
|
|
||||||
|
if isinstance(other, Series):
|
||||||
|
return Series([j and other[i] for i, j in enumerate(self)], "bool")
|
||||||
|
|
||||||
|
return Series([i and other for i in self.data], "bool")
|
||||||
|
|
||||||
|
def __or__(self, other):
|
||||||
|
other = self._comparison_validator(other)
|
||||||
|
|
||||||
|
if isinstance(other, Series):
|
||||||
|
return Series([j or other[i] for i, j in enumerate(self)], "bool")
|
||||||
|
|
||||||
|
return Series([i or other for i in self.data], "bool")
|
||||||
|
|
||||||
def _math_validator(self, other):
|
def _math_validator(self, other):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user