mirror of
https://github.com/wassname/geopandas.git
synced 2026-09-10 12:00:21 +08:00
Merge pull request #28 from kjordahl/bug/series_unary_op
BUG: _series_unary_op should return a series
This commit is contained in:
@@ -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)
|
||||
|
||||
#
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user