petern48 commented on code in PR #2080:
URL: https://github.com/apache/sedona/pull/2080#discussion_r2201105347


##########
python/sedona/geopandas/geoseries.py:
##########
@@ -2283,14 +2347,34 @@ def get_first_geometry_column(self) -> Union[str, None]:
             ),
             None,
         )
-        return first_binary_or_geometry_col
+        if first_binary_or_geometry_col:
+            return first_binary_or_geometry_col
+
+        raise ValueError(
+            "get_first_geometry_column: No geometry column found in the 
GeoSeries."
+        )
 
 
 # -----------------------------------------------------------------------------
 # # Utils
 # -----------------------------------------------------------------------------
 
 
+def _to_spark_pandas_df(ps_series: pspd.Series) -> pspd.DataFrame:
+    return pspd.DataFrame(ps_series._psdf._internal)
+
+
+def to_bool(ps_series: pspd.Series, default: bool = False) -> pspd.Series:
+    """
+    Cast a ps.Series to bool type if it's not one, converting None values to 
the default value.
+    """
+    if ps_series.dtype.name != "bool":
+        # fill None values with the default value
+        ps_series.fillna(default, inplace=True)
+

Review Comment:
   I specifically do not want to call `.astype('bool')` here. If a `None` 
happens to slip by somehow (e.g without the intersects workaround), casting to 
bool would cast it to a True, which is undesirable behavior. I'd rather leave 
out the astype("bool") here and let the tests fail if for some reason the 
fillna doesn't convert all values to booleans.



-- 
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]

Reply via email to