Skip to content

Commit dfedd59

Browse files
[compat]: Fixed test for pandas>2 (#251)
* [compat]: Fixed test for pandas>2 pandas 2.0 changed a behavior w.r.t. groupby and non-numeric columns. This test doesn't need to drop the columns anymore. xref geopandas/geopandas#1999 * fixup * Bump versions * Update environments --------- Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
1 parent 22ba253 commit dfedd59

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

continuous_integration/envs/310-latest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
dependencies:
55
# required dependencies
66
- python=3.10
7-
- dask=2022.10.0
7+
- dask
88
- distributed
99
- geopandas
1010
- pygeos

continuous_integration/envs/38-minimal.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ dependencies:
66
- python=3.8
77
- numpy=1.20
88
- dask=2021.06.0
9-
- distributed
9+
- distributed=2021.06.0
1010
- geopandas=0.10
11+
- pandas=1.5.3
1112
- pygeos
1213
- pyproj=2.6
1314
- packaging

continuous_integration/envs/39-no-optional-deps.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
dependencies:
55
# required dependencies
66
- python=3.9
7-
- dask=2022.6.0
7+
- dask
88
- distributed
99
- geopandas
1010
- pygeos

dask_geopandas/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
DASK_2022_8_1 = Version(dask.__version__) >= Version("2022.8.1")
2727
GEOPANDAS_0_12 = Version(geopandas.__version__) >= Version("0.12.0")
28+
PANDAS_2_0_0 = Version(pd.__version__) >= Version("2.0.0")
2829

2930

3031
if Version(shapely.__version__) < Version("2.0"):

dask_geopandas/tests/test_core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from dask_geopandas.hilbert_distance import _hilbert_distance
1616
from dask_geopandas.morton_distance import _morton_distance
1717
from dask_geopandas.geohash import _geohash
18+
from dask_geopandas.core import PANDAS_2_0_0
1819

1920

2021
@pytest.fixture
@@ -640,9 +641,11 @@ def test_sum(self):
640641
gpd_sum = self.world.dissolve("continent", aggfunc="sum")
641642
dd_sum = self.ddf.dissolve("continent", aggfunc="sum").compute()
642643
# drop due to https://github.com/geopandas/geopandas/issues/1999
643-
assert_geodataframe_equal(
644-
gpd_sum, dd_sum.drop(columns=["name", "iso_a3"]), check_like=True
645-
)
644+
if not PANDAS_2_0_0:
645+
drop = ["name", "iso_a3"]
646+
else:
647+
drop = []
648+
assert_geodataframe_equal(gpd_sum, dd_sum.drop(columns=drop), check_like=True)
646649

647650
@pytest.mark.skipif(
648651
Version(dask.__version__) == Version("2022.01.1"),

0 commit comments

Comments
 (0)