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

Pickling DaskGeoDataFrame loses spatial_partitions #237

Closed
TomAugspurger opened this issue Feb 9, 2023 · 0 comments · Fixed by #238
Closed

Pickling DaskGeoDataFrame loses spatial_partitions #237

TomAugspurger opened this issue Feb 9, 2023 · 0 comments · Fixed by #238

Comments

@TomAugspurger
Copy link
Contributor

This is a bit of a strange use-case, but roundtripping a GeoDataFrame through pickle loses the spatial_partitions property:

import dask_geopandas
import geopandas.datasets
import pickle


df = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
ddf = dask_geopandas.from_geopandas(df, npartitions=2)
print(ddf.spatial_partitions)  # None
ddf2 = pickle.loads(pickle.dumps(df))
print(ddf2.spatial_partitions)  # AttributeError

__init__ doesn't run, so it's never set at

self.spatial_partitions = spatial_partitions
.

Maybe adding spatial partitions to _args to mirror dask.dataframe._Frame like in https://github.com/dask/dask/blob/main/dask/dataframe/core.py#L233-L241 would do the trick.

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

Successfully merging a pull request may close this issue.

1 participant