Copilot commented on code in PR #2046:
URL: https://github.com/apache/sedona/pull/2046#discussion_r2202031422
##########
python/sedona/geopandas/geoseries.py:
##########
@@ -537,7 +537,9 @@ def _to_geopandas(self) -> gpd.GeoSeries:
try:
return gpd.GeoSeries(
pd_series.map(
- lambda wkb: shapely.wkb.loads(bytes(wkb)) if wkb else None
+ lambda wkb: (
+ shapely.wkb.loads(bytes(wkb)) if not pd.isna(wkb) else
None
Review Comment:
The current check only skips NaN/NA but will attempt to load empty byte
strings, which may cause a WKB parse error. Add a truthiness check (e.g. `if
wkb and not pd.isna(wkb)`) to skip empty bytes.
```suggestion
shapely.wkb.loads(bytes(wkb)) if wkb and not
pd.isna(wkb) else None
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]