当前位置: 首页>>代码示例>>Python>>正文


Python GeoSeries.sort_index方法代码示例

本文整理汇总了Python中geopandas.GeoSeries.sort_index方法的典型用法代码示例。如果您正苦于以下问题:Python GeoSeries.sort_index方法的具体用法?Python GeoSeries.sort_index怎么用?Python GeoSeries.sort_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geopandas.GeoSeries的用法示例。


在下文中一共展示了GeoSeries.sort_index方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestSeries

# 需要导入模块: from geopandas import GeoSeries [as 别名]
# 或者: from geopandas.GeoSeries import sort_index [as 别名]
class TestSeries(unittest.TestCase):
    def setUp(self):
        N = self.N = 10
        r = 0.5
        self.pts = GeoSeries([Point(x, y) for x, y in zip(range(N), range(N))])
        self.polys = self.pts.buffer(r)

    def test_slice(self):
        assert type(self.pts[:2]) is GeoSeries
        assert type(self.pts[::2]) is GeoSeries
        assert type(self.polys[:2]) is GeoSeries

    @unittest.skip("not yet implemented")
    def test_head(self):
        assert type(self.pts.head()) is GeoSeries

    @unittest.skip("not yet implemented")
    def test_tail(self):
        assert type(self.pts.tail()) is GeoSeries

    def test_sort_index(self):
        assert type(self.pts.sort_index()) is GeoSeries

    def test_sort_order(self):
        assert type(self.pts.order()) is GeoSeries

    @unittest.skip("not yet implemented")
    def test_loc(self):
        assert type(self.pts.loc[5:]) is GeoSeries

    @unittest.skip("not yet implemented")
    def test_iloc(self):
        assert type(self.pts.iloc[5:]) is GeoSeries

    def test_fancy(self):
        idx = (self.pts.index % 2).astype(bool)
        assert type(self.pts[idx]) is GeoSeries

    def test_take(self):
        assert type(self.pts.take(range(0, self.N, 2))) is GeoSeries

    def test_select(self):
        assert type(self.pts.select(lambda x: x % 2 == 0)) is GeoSeries

    @unittest.skip("not yet implemented")
    def test_groupby(self):
        for f, s in self.pts.groupby(lambda x: x % 2):
            assert type(s) is GeoSeries
开发者ID:radoraykov,项目名称:geopandas,代码行数:50,代码来源:test_types.py

示例2: setup_method

# 需要导入模块: from geopandas import GeoSeries [as 别名]
# 或者: from geopandas.GeoSeries import sort_index [as 别名]
class TestSeries:

    def setup_method(self):
        N = self.N = 10
        r = 0.5
        self.pts = GeoSeries([Point(x, y) for x, y in zip(range(N), range(N))])
        self.polys = self.pts.buffer(r)

    def test_slice(self):
        assert type(self.pts[:2]) is GeoSeries
        assert type(self.pts[::2]) is GeoSeries
        assert type(self.polys[:2]) is GeoSeries

    def test_head(self):
        assert type(self.pts.head()) is GeoSeries

    def test_tail(self):
        assert type(self.pts.tail()) is GeoSeries

    def test_sort_index(self):
        assert type(self.pts.sort_index()) is GeoSeries

    def test_loc(self):
        assert type(self.pts.loc[5:]) is GeoSeries

    def test_iloc(self):
        assert type(self.pts.iloc[5:]) is GeoSeries

    def test_fancy(self):
        idx = (self.pts.index.to_series() % 2).astype(bool)
        assert type(self.pts[idx]) is GeoSeries

    def test_take(self):
        assert type(self.pts.take(list(range(0, self.N, 2)))) is GeoSeries

    def test_select(self):
        with warnings.catch_warnings(record=True) as _:
            # depending on pandas version this raises FutureWarning ->
            # suppress it
            assert type(self.pts.select(lambda x: x % 2 == 0)) is GeoSeries

    def test_groupby(self):
        for f, s in self.pts.groupby(lambda x: x % 2):
            assert type(s) is GeoSeries
开发者ID:geopandas,项目名称:geopandas,代码行数:46,代码来源:test_types.py

示例3: TestSeries

# 需要导入模块: from geopandas import GeoSeries [as 别名]
# 或者: from geopandas.GeoSeries import sort_index [as 别名]
class TestSeries(unittest.TestCase):

    def setUp(self):
        N = self.N = 10
        r = 0.5
        self.pts = GeoSeries([Point(x, y) for x, y in zip(range(N), range(N))])
        self.polys = self.pts.buffer(r)

    def test_slice(self):
        assert type(self.pts[:2]) is GeoSeries
        assert type(self.pts[::2]) is GeoSeries
        assert type(self.polys[:2]) is GeoSeries

    def test_head(self):
        assert type(self.pts.head()) is GeoSeries

    def test_tail(self):
        assert type(self.pts.tail()) is GeoSeries

    def test_sort_index(self):
        assert type(self.pts.sort_index()) is GeoSeries

    def test_loc(self):
        assert type(self.pts.loc[5:]) is GeoSeries

    def test_iloc(self):
        assert type(self.pts.iloc[5:]) is GeoSeries

    def test_fancy(self):
        idx = (self.pts.index.to_series() % 2).astype(bool)
        assert type(self.pts[idx]) is GeoSeries

    def test_take(self):
        assert type(self.pts.take(list(range(0, self.N, 2)))) is GeoSeries

    def test_select(self):
        assert type(self.pts.select(lambda x: x % 2 == 0)) is GeoSeries

    @unittest.skipIf(OLD_PANDAS, 'Groupby not supported on pandas <= 0.12')
    def test_groupby(self):
        for f, s in self.pts.groupby(lambda x: x % 2):
            assert type(s) is GeoSeries
开发者ID:JamesPHoughton,项目名称:geopandas,代码行数:44,代码来源:test_types.py


注:本文中的geopandas.GeoSeries.sort_index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。