Skip to content

Commit

Permalink
Change _GeoSeriesUtility._from_data(index=) default to None (#1400)
Browse files Browse the repository at this point in the history
An upstream change in cudf uncovered a bug in `_GeoSeriesUtility._from_data` where `False` was being passed to `cudf.Series(index=)` which is an invalid value. The only valid `index` values are an actual `cudf.Index` or `None`, so setting to `None` as a more appropriate default value

Also updates the location of `assert_eq` which moved in rapidsai/cudf#16063

Authors:
  - Matthew Roeschke (https://github.com/mroeschke)

Approvers:
  - Paul Taylor (https://github.com/trxcllnt)
  - Mark Harris (https://github.com/harrism)
  - Bradley Dice (https://github.com/bdice)

URL: #1400
  • Loading branch information
mroeschke authored Jul 8, 2024
1 parent bc2ca80 commit e51e8b0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ files:
includes:
- cuda_version
- depends_on_cuml
- test_notebooks
- notebooks
- py_version
- test_cuspatial
Expand Down Expand Up @@ -334,6 +335,12 @@ dependencies:
- output_types: [conda]
packages:
- curl
# TODO: Remove geopandas.dataset usage in cuspatial_api_examples.ipynb
test_notebooks:
common:
- output_types: [conda, requirements, pyproject]
packages:
- geopandas<1
py_version:
specific:
- output_types: conda
Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/core/geodataframe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2022, NVIDIA CORPORATION
# Copyright (c) 2020-2024, NVIDIA CORPORATION
from typing import Dict, Tuple, TypeVar, Union

import pandas as pd
Expand Down Expand Up @@ -303,7 +303,7 @@ def reset_index(

class _GeoSeriesUtility:
@classmethod
def _from_data(cls, new_data, name=None, index=False):
def _from_data(cls, new_data, name=None, index=None):
new_column = new_data.columns[0]
if is_geometry_type(new_column):
return GeoSeries(new_column, name=name, index=index)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

from shapely.geometry import LineString

import cudf
from cudf.testing._utils import assert_eq
from cudf.testing import assert_eq

import cuspatial

Expand Down
2 changes: 1 addition & 1 deletion python/cuspatial/cuspatial/tests/test_geodataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def test_memory_usage(gs, data_dir):
host_dataframe = gpd.read_file(data_dir / "naturalearth_lowres.shp")
gpu_dataframe = cuspatial.from_geopandas(host_dataframe)
# The df size is 8kb of cudf rows and 217kb of the geometry column
assert gpu_dataframe.memory_usage().sum() == 216793
assert gpu_dataframe.memory_usage().sum() == 216789


def test_from_dict():
Expand Down
2 changes: 1 addition & 1 deletion python/cuspatial/cuspatial/tests/test_geoseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def test_memory_usage_simple(gs):
def test_memory_usage_large(naturalearth_lowres):
geometry = cuspatial.from_geopandas(naturalearth_lowres)["geometry"]
# the geometry column from naturalearth_lowres is 217kb of coordinates
assert geometry.memory_usage() == 216793
assert geometry.memory_usage() == 216789


@pytest.mark.parametrize("level", [None, 0, 1])
Expand Down

0 comments on commit e51e8b0

Please sign in to comment.