starepandas.STAREDataFrame.stare_dissolve#
- STAREDataFrame.stare_dissolve(by=None, num_workers=1, geom=False, aggfunc='first', **kwargs)#
Dissolves a dataframe subject to a field. I.e. grouping by a field/column. Seminal method to GeoDataFrame.dissolve()
- Parameters:
- by: str
column to use the dissolve on. If None, dissolve all rows.
- num_workers: int
workers to use for the dissolve
- geom: bool
Toggle if the geometry column is to be dissolved. Geom column Will be dropped if set to False.
- aggfunc: str
aggregation function. E.g. ‘first’, ‘sum’, ‘mean’.
Examples
>>> import geopandas >>> world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres')) >>> west = world[world['continent'].isin(['Europe', 'North America'])] >>> west = starepandas.STAREDataFrame(west, add_sids=True, level=4, add_trixels=False) >>> west.stare_dissolve(by='continent', aggfunc='sum') stare ... gdp_md_est continent ... Europe [648518346341351428, 900719925474099204, 10448... ... 25284877.0 North America [1170935903116328964, 1173187702930014212, 117... ... 23505137.0