Move overloaded operators to GeoSeries

This commit is contained in:
Jacob Wasserman
2013-12-27 11:17:46 -05:00
parent 1f6dfbde17
commit 8db12e6d49
2 changed files with 20 additions and 21 deletions
-21
View File
@@ -390,27 +390,6 @@ class GeoPandasBase(object):
index=self.index, crs=self.crs)
#
# Implement standard operators for GeoSeries
#
def __xor__(self, other):
"""Implement ^ operator as for builtin set type"""
return self.symmetric_difference(other)
def __or__(self, other):
"""Implement | operator as for builtin set type"""
return self.union(other)
def __and__(self, other):
"""Implement & operator as for builtin set type"""
return self.intersection(other)
def __sub__(self, other):
"""Implement - operator as for builtin set type"""
return self.difference(other)
def _array_input(arr):
if isinstance(arr, (MultiPoint, MultiLineString, MultiPolygon)):
# Prevent against improper length detection when input is a
+20
View File
@@ -241,3 +241,23 @@ class GeoSeries(GeoPandasBase, Series):
result.__class__ = GeoSeries
result.crs = crs
return result
#
# Implement standard operators for GeoSeries
#
def __xor__(self, other):
"""Implement ^ operator as for builtin set type"""
return self.symmetric_difference(other)
def __or__(self, other):
"""Implement | operator as for builtin set type"""
return self.union(other)
def __and__(self, other):
"""Implement & operator as for builtin set type"""
return self.intersection(other)
def __sub__(self, other):
"""Implement - operator as for builtin set type"""
return self.difference(other)