You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2026/10/20 05:54:00 UTC
[PR] feat(python/sedonadb-geopandas): add Series where, mask, clip, between, round, abs, dropna, and head [sedona-db]
jiayuasu opened a new pull request, #1469:
URL: https://github.com/apache/sedona-db/pull/1469
## What changes
Adds element-wise selection, bounds, and rounding to `Series` / `GeoSeries` in `sedonadb-geopandas`, following pandas:
- **`where(cond, other)` / `mask(cond, other)`**: `cond` is a boolean Series from the same frame, or a callable returning one. As in pandas, a value is kept only where the condition is definitely true (`where`) or definitely false (`mask`), so a missing condition replaces it. The default replacement is a missing value. The engine has no `CASE` expression here, so the choice goes through `nvl2` with the condition as a flag of the values' own type. On a `GeoSeries` the choice is made on WKB, as in `fillna()`, and the result keeps the column's spatial kind (geography stays geography) and CRS; a replacement geometry in another CRS raises.
- **`clip(lower, upper)`**: scalar or same-frame Series bounds. A missing bound is no bound, a missing value stays missing, and two scalar bounds in the wrong order are swapped, as in pandas. Comparisons follow pandas (#1452), so `-0.0` meets a lower bound of `0.0`.
- **`between(left, right, inclusive=...)`**: `"both"`, `"neither"`, `"left"`, `"right"`, with pandas' validation message.
- **`round(decimals)`**: half to even with NumPy's scale, round, unscale steps, in the column's own precision (float32 stays float32), so `0.5 -> 0.0`, `2.675 -> 2.68` and `-0.5 -> -0.0` as in pandas; the engine's `round()` sends halves away from zero. Negative `decimals` round integers too; booleans are unchanged.
- **`abs()` / `abs(series)`**: numbers and timedeltas (the engine's `abs()` does not take durations); booleans are unchanged.
- **`dropna()` / `head(n)`**: return a column of a new frame, which, like any column of another frame, can't be combined with the original's. `head()` refuses a negative count (no row order to count back from), on frames too, where it failed with an `OverflowError`.
Differences from pandas, documented in the README: a replacement or bound of another kind of value (text in a number column, say) raises rather than turning the column into Python objects, and `round()` raises for a non-numeric column, as pandas 2 does (pandas 3 returns it unchanged).
## Testing
`tests/test_series_elementwise.py` compares each method against pandas on float, integer, string, timedelta, and geometry columns, including missing values, NaN, infinity, signed zeros, Series bounds and replacements, missing conditions, geography, and the validation errors.
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(python/sedonadb-geopandas): add Series where, mask, clip, between, round, abs, dropna, and head [sedona-db]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #1469:
URL: https://github.com/apache/sedona-db/pull/1469
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(python/sedonadb-geopandas): add Series where, mask, clip, between, round, abs, dropna, and head [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on PR #1469:
URL: https://github.com/apache/sedona-db/pull/1469#issuecomment-6317664006
> Since this PR is small, I plan to merge it within a day if there are no objections.
I usually leave a PR open for 72 hours before invoking lazy consensus (unless it is something affecting CI on every PR). Between midnight and 8 am is not really enough time for anybody who did want to contribute to weigh in.
Maybe the geopandas wrapper should be developed as an third-party project and donated if there is more widespread interest in development or review?
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(python/sedonadb-geopandas): add Series where, mask, clip, between, round, abs, dropna, and head [sedona-db]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #1469:
URL: https://github.com/apache/sedona-db/pull/1469#issuecomment-6286056538
Since this PR is small, I plan to merge it within a day if there are no objections.
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(python/sedonadb-geopandas): add Series where, mask, clip, between, round, abs, dropna, and head [sedona-db]
Posted by "james-willis (via GitHub)" <gi...@apache.org>.
james-willis commented on PR #1469:
URL: https://github.com/apache/sedona-db/pull/1469#issuecomment-6300432683
make sure precommit is clean before merging
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org