Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dissolve does not accept multiple columns to groupBy #304

Open
toihr opened this issue Jul 22, 2024 · 0 comments
Open

dissolve does not accept multiple columns to groupBy #304

toihr opened this issue Jul 22, 2024 · 0 comments

Comments

@toihr
Copy link

toihr commented Jul 22, 2024

In the GeoPandas implementation you can dissolve by multiple columns (by grouping by multiple columns) i.e.

blotch_gpd.dissolve(["obsid","tile_id"])

when this is done in dask_geopandas i obtain the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[37], line 7
      5 result3 = dgp.from_dask_dataframe(blotch_dd,geometry=result2.compute())
      6 result3 = result3.set_crs("EPSG:27700")
----> 7 result4 = result3.dissolve(["obsid","tile_id"])

File ~/.miniforge3/envs/planetary/lib/python3.9/site-packages/dask_geopandas/expr.py:733, in GeoDataFrame.dissolve(self, by, aggfunc, split_out, **kwargs)
    731     data_agg = aggfunc
    732 else:
--> 733     data_agg = {col: aggfunc for col in self.columns.drop(drop)}
    734 data_agg[self.geometry.name] = merge_geometries
    735 # dask 2022.8.1 added shuffle keyword, enabled by default if split_out > 1
    736 # starting with dask 2022.9.1, but geopandas doesn't yet work with shuffle
    737 # https://github.com/geopandas/dask-geopandas/pull/229

File ~/.miniforge3/envs/planetary/lib/python3.9/site-packages/pandas/core/indexes/base.py:7066, in Index.drop(self, labels, errors)
   7063     arr_dtype = "object" if self.dtype == "object" else None
   7064     labels = com.index_labels_to_array(labels, dtype=arr_dtype)
-> 7066 indexer = self.get_indexer_for(labels)
   7067 mask = indexer == -1
   7068 if mask.any():

File ~/.miniforge3/envs/planetary/lib/python3.9/site-packages/pandas/core/indexes/base.py:6182, in Index.get_indexer_for(self, target)
   6164 """
...
File index.pyx:351, in pandas._libs.index.IndexEngine.get_indexer()

File pandas/_libs/hashtable_class_helper.pxi:7132, in pandas._libs.hashtable.PyObjectHashTable.lookup()

TypeError: unhashable type: 'list'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant