Merge pull request #28 from kjordahl/bug/series_unary_op

BUG: _series_unary_op should return a series
This commit is contained in:
Kelsey Jordahl
2013-09-06 15:42:29 -07:00
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ class GeoSeries(Series):
def _series_unary_op(self, op):
"""Unary operation that returns a Series"""
return GeoSeries([getattr(geom, op) for geom in self],
return Series([getattr(geom, op) for geom in self],
index=self.index)
#
+2
View File
@@ -1,6 +1,7 @@
import unittest
import numpy as np
from numpy.testing import assert_array_equal
from pandas import Series
from shapely.geometry import Polygon, Point, LineString
from shapely.geometry.base import BaseGeometry
from geopandas import GeoSeries
@@ -38,6 +39,7 @@ class TestSeries(unittest.TestCase):
crs={'init': 'epsg:4326', 'no_defs': True})
def test_area(self):
assert type(self.g1.area) is Series
assert_array_equal(self.g1.area.values, np.array([0.5, 1.0]))
def test_in(self):