-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Boolean indexing with Dask object causes conversion of Dask-Geopandas object to Dask object #224
Comments
Hey i did some exploring and found out some interesting stuff.
This only occurs when dealing with GeoSeries, as GeoDataFrame is working as expected. I found out something else too and it is that GeoSeries gets transformed back to dask.series even without boolean indexing but with some operation done on the series.
I have tried to find something inside the _Frame super class, with no results. Maybe here we need someone from the core team to check it out. I'm using |
I agree. I wonder if the fix is as easy as what's done in def _wrapped_pandas_method(self, mtd, *args, **kwargs):
"""Wrap a generic pandas method to ensure it returns a GeoSeries"""
val = getattr(super(), mtd)(*args, **kwargs)
if type(val) == Series:
val.__class__ = GeoSeries
val.crs = self.crs
return val
def __getitem__(self, key):
return self._wrapped_pandas_method("__getitem__", key) |
This makes sense, Geopandas has no wrapping method for GeoDataFrames, but it does, as you show, for GeoSeries. I would be willing to work on a PR that addresses this problem in the coming days. |
The title might not be accurate since it is mostly my guess at what's going on here, but I would expect to still have a
dask-geopandas
object after indexing.I'm using version 0.2.0 of
dask-geopandas
.The text was updated successfully, but these errors were encountered: