mirror of
https://github.com/wassname/geopandas.git
synced 2026-09-10 12:00:21 +08:00
Implement standard set operators ^ | & -
This commit is contained in:
@@ -357,6 +357,34 @@ class GeoSeries(Series):
|
||||
else:
|
||||
return False
|
||||
|
||||
def __xor__(self, other):
|
||||
"""
|
||||
The ^ operator implements symmetric_difference() as it does
|
||||
for the builtin set type.
|
||||
"""
|
||||
return self.symmetric_difference(other)
|
||||
|
||||
def __or__(self, other):
|
||||
"""
|
||||
The | operator implements union() as it does
|
||||
for the builtin set type.
|
||||
"""
|
||||
return self.union(other)
|
||||
|
||||
def __and__(self, other):
|
||||
"""
|
||||
The & operator implements intersection() as it does
|
||||
for the builtin set type.
|
||||
"""
|
||||
return self.intersection(other)
|
||||
|
||||
def __sub__(self, other):
|
||||
"""
|
||||
The - operator implements difference() as it does
|
||||
for the builtin set type.
|
||||
"""
|
||||
return self.difference(other)
|
||||
|
||||
#
|
||||
# Implement pandas methods
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user