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 9, 2024
1 parent 3cf61a2 commit fab67bd
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)

Check warning on line 101 in dcpy/lifecycle/ingest/transform.py

View check run for this annotation

Codecov / codecov/patch

dcpy/lifecycle/ingest/transform.py#L101

Added line #L101 was not covered by tests
renamed = renamed.rename(columns=map, errors="raise")
if drop_others:
renamed = renamed[list(map.values())]
Expand Down

0 comments on commit fab67bd

Please sign in to comment.