Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Support window partition by geo column #1512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bigframes/core/compile/compiled.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,11 @@ def _join_condition(


def _as_groupable(value: ibis_types.Value):
# Some types need to be converted to string to enable groupby
if value.type().is_float64() or value.type().is_geospatial():
# Some types need to be converted to another type to enable groupby
if value.type().is_float64():
return value.cast(ibis_dtypes.str)
elif value.type().is_geospatial():
return typing.cast(ibis_types.GeoSpatialColumn, value).as_binary()
elif value.type().is_json():
return scalar_op_compiler.to_json_string(value)
else:
Expand Down
17 changes: 17 additions & 0 deletions tests/system/small/geopandas/test_geoseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,20 @@ def test_geo_difference_with_similar_geometry_objects():
assert expected.iloc[0].equals(bf_result.iloc[0])
assert expected.iloc[1].equals(bf_result.iloc[1])
assert expected.iloc[2].equals(bf_result.iloc[2])


def test_geo_drop_duplicates():
bf_series = bigframes.geopandas.GeoSeries(
[Point(1, 1), Point(2, 2), Point(3, 3), Point(2, 2)]
)

pd_series = geopandas.GeoSeries(
[Point(1, 1), Point(2, 2), Point(3, 3), Point(2, 2)]
)

bf_result = bf_series.drop_duplicates().to_pandas()
pd_result = pd_series.drop_duplicates()

pd.testing.assert_series_equal(
geopandas.GeoSeries(bf_result), pd_result, check_index=False
)