Skip to content

Commit

Permalink
fix renaming of geom column
Browse files Browse the repository at this point in the history
  • Loading branch information
fvankrieken committed Oct 2, 2024
1 parent 9048c6e commit 1a3fd42
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dcpy/lifecycle/ingest/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def rename_columns(
self, df: pd.DataFrame, map: dict[str, str], drop_others=False
) -> pd.DataFrame:
renamed = df.copy()
if isinstance(renamed, gpd.GeoDataFrame) and renamed.geometry.name in map:
renamed.rename_geometry(map.pop(renamed.geometry.name), inplace=True)
renamed = renamed.rename(columns=map, errors="raise")
if drop_others:
renamed = renamed[list(map.values())]
Expand Down

0 comments on commit 1a3fd42

Please sign in to comment.