jiayuasu commented on code in PR #1050:
URL: https://github.com/apache/sedona-db/pull/1050#discussion_r3582773146
##########
python/sedonadb/python/sedonadb/dataframe.py:
##########
@@ -504,6 +504,49 @@ def drop(self, *cols: str) -> "DataFrame":
return DataFrame(self._ctx, self._impl.drop_columns(list(cols)))
+ def unnest(self, *columns: str) -> "DataFrame":
+ """Expand list/array column(s) so each element becomes its own row.
+
+ This is the relational form of `pandas`/`GeoPandas` `explode()`: for
+ each input row, a list-typed column is expanded to one output row per
+ element, with the other columns repeated. When several columns are
+ given, they are unnested in parallel (position by position).
+
+ A common spatial use is flattening a multi-geometry: `ST_Dump(geom)`
+ returns a list of parts, and `unnest()` turns each part into its own
+ row.
+
Review Comment:
Good call — added an example. It walks through `ST_Dump` → `unnest` →
pulling the geometry out of the `{path, geom}` struct
(`dumped["dump"]["geom"]`), rendering the two points. Used the `.geo.dump()`
accessor as you suggested.
--
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]