Skip to content

Commit

Permalink
Fix _recombine_columns when either geocolumn or non-geocolumn was emp…
Browse files Browse the repository at this point in the history
…ty (#1438)

closes #1437

When `GeoDataFrame._split_out_geometry_columns` is called, there may be no geometry columns to split out into 2 DataFrames; therefore, once `GeoDataFrame._recombine_columns`, it assumed the 2 DataFrames were always non-empty. Added a check to bypass this validation if either was empty.

I ran the `ZipCodes_Stops_PiP_cuSpatial` notebook locally and the (non-commented) cells no longer raise an exception.

Authors:
  - Matthew Roeschke (https:/mroeschke)
  - James Lamb (https:/jameslamb)

Approvers:
  - Mark Harris (https:/harrism)

URL: #1438
  • Loading branch information
mroeschke authored Aug 13, 2024
1 parent 93a1653 commit 314dc7d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/cuspatial/cuspatial/core/geodataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ def _recombine_columns(
The output is meant for GeoDataFrame._from_data.
"""
if not geo_columns.index.equals(data_columns.index):
if not (
geo_columns.empty
or data_columns.empty
or geo_columns.index.equals(data_columns.index)
):
raise ValueError("geo_columns.index must equal data_columns.index")

columns_mask = self.columns
Expand Down

0 comments on commit 314dc7d

Please sign in to comment.