From d83d088c870996a8ab29a8a01c800375a1324ff1 Mon Sep 17 00:00:00 2001 From: Martin Fleischmann Date: Wed, 26 Jun 2024 08:05:01 +0200 Subject: [PATCH] geopandas sjoin change compatibility --- pyinterpolate/distance/gridding.py | 2 +- pyinterpolate/processing/preprocessing/blocks.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyinterpolate/distance/gridding.py b/pyinterpolate/distance/gridding.py index dfbdbc3d..5d0a3027 100644 --- a/pyinterpolate/distance/gridding.py +++ b/pyinterpolate/distance/gridding.py @@ -220,7 +220,7 @@ def points_to_grid(points: gpd.GeoDataFrame, aggregated : geopandas GeoDataFrame """ - joined = points.sjoin(grid, how='left', predicate='within') + joined = points.sjoin(grid.rename_axis("index_right"), how='left', predicate='within') joined.drop('geometry', axis=1, inplace=True) grouped = joined.groupby('index_right').mean() aggregated = grid.join(grouped) diff --git a/pyinterpolate/processing/preprocessing/blocks.py b/pyinterpolate/processing/preprocessing/blocks.py index d75e348b..850e7acf 100644 --- a/pyinterpolate/processing/preprocessing/blocks.py +++ b/pyinterpolate/processing/preprocessing/blocks.py @@ -426,7 +426,7 @@ def from_geodataframes(self, point_support, blocks = self._transform_crs(point_support, blocks, use_point_support_crs) # Merge data - joined = gpd.sjoin(point_support, blocks, how='left') + joined = gpd.sjoin(point_support, blocks.rename_axis("index_right"), how='left') # Check which points weren't joined if self.log_dropped: