nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: geopandas/geopandas
Pull request #3047 (2023-10-21 17:02:43)

BUG: fix interiors when no interior is present
When doing #3013, when @m-richards pointed out that we may need to keep the allocation of an empty array and then its population, we thought we don't since we thought it is shapely 1.8 related. Well, it was not :D. When there is no actual interior, this is now failing on main.

Fixed. No need for changelog as it fixed unreleased #3013.


Patch:
diff --git a/geopandas/array.py b/geopandas/array.py
index 403eeb6e..4b6c6685 100644
--- a/geopandas/array.py
+++ b/geopandas/array.py
@@ -590,7 +590,9 @@ class GeometryArray(ExtensionArray):
                 "geometry types, None is returned.",
                 stacklevel=2,
             )
-        data = np.array(inner_rings, dtype=object)
+        # need to allocate empty first in case of all empty lists in inner_rings
+        data = np.empty(len(inner_rings), dtype=object)
+        data[:] = inner_rings
         return data
 
     def remove_repeated_points(self, tolerance=0.0):


Test patch:
diff --git a/geopandas/tests/test_geom_methods.py b/geopandas/tests/test_geom_methods.py
index 28f7b518..a72ad78e 100644
--- a/geopandas/tests/test_geom_methods.py
+++ b/geopandas/tests/test_geom_methods.py
@@ -964,6 +964,10 @@ class TestGeomMethods:
         expected = LinearRing(self.inner_sq.boundary)
         assert original.interiors[1][0].equals(expected)
 
+        no_interiors = GeoSeries([self.t1, self.sq])
+        assert no_interiors.interiors[0] == []
+        assert no_interiors.interiors[1] == []
+
     def test_interpolate(self):
         expected = GeoSeries([Point(0.5, 1.0), Point(0.75, 1.0)])
         self._test_binary_topological(
Repository: geopandas/geopandas
Pull request #3052 (2023-10-26 21:13:41)

API: make count_coordinates a method
Follow-up on #3026


Patch:
diff --git a/geopandas/array.py b/geopandas/array.py
index b9052514..4017cf15 100644
--- a/geopandas/array.py
+++ b/geopandas/array.py
@@ -521,7 +521,6 @@ class GeometryArray(ExtensionArray):
         self.check_geographic_crs(stacklevel=5)
         return shapely.length(self._data)
 
-    @property
     def count_coordinates(self):
         out = np.empty(len(self._data), dtype=np.int_)
         out[:] = [shapely.count_coordinates(s) for s in self._data]
diff --git a/geopandas/base.py b/geopandas/base.py
index a2de795f..ccd9b10f 100644
--- a/geopandas/base.py
+++ b/geopandas/base.py
@@ -329,7 +329,6 @@ GeometryCollection
         """
         return _delegate_property("is_empty", self)
 
-    @property
     def count_coordinates(self):
         """
         Returns a ``Series`` containing the count of the number of coordinate pairs
@@ -358,7 +357,7 @@ GeometryCollection
         4                                             None
         dtype: geometry
 
-        >>> s.count_coordinates
+        >>> s.count_coordinates()
         0    4
         1    3
         2    1
@@ -370,7 +369,7 @@ GeometryCollection
         --------
         GeoSeries.get_coordinates : extract coordinates as a :class:`~pandas.DataFrame`
         """
-        return _delegate_property("count_coordinates", self)
+        return Series(self.geometry.values.count_coordinates(), index=self.index)
 
     @property
     def is_simple(self):


Test patch:
diff --git a/geopandas/tests/test_geom_methods.py b/geopandas/tests/test_geom_methods.py
index 26d440c0..0c0cd347 100644
--- a/geopandas/tests/test_geom_methods.py
+++ b/geopandas/tests/test_geom_methods.py
@@ -499,10 +499,10 @@ class TestGeomMethods:
 
     def test_count_coordinates(self):
         expected = Series(np.array([4, 5]), index=self.g1.index)
-        self._test_unary_real("count_coordinates", expected, self.g1)
+        assert_series_equal(self.g1.count_coordinates(), expected)
 
         expected = Series(np.array([4, 0]), index=self.na_none.index)
-        self._test_unary_real("count_coordinates", expected, self.na_none)
+        assert_series_equal(self.na_none.count_coordinates(), expected)
 
     def test_crosses(self):
         expected = [False, False, False, False, False, False, False]
Repository: geopandas/geopandas
Pull request #3191 (2024-02-18 02:12:29)

COMPAT: pandas 3 related test updates
Two fixes
* the deprecated convert_dtypes has been removed
* In dissolve, the value for geometry in non observed categorical groups has changed (due to https://github.com/pandas-dev/pandas/pull/55738). We also should deprecated the default of observed from false to true to match pandas (created #3192 for this).


Patch:
diff --git a/geopandas/_compat.py b/geopandas/_compat.py
index f254bd64..034d28fb 100644
--- a/geopandas/_compat.py
+++ b/geopandas/_compat.py
@@ -14,7 +14,8 @@ PANDAS_GE_14 = Version(pd.__version__) >= Version("1.4.0rc0")
 PANDAS_GE_15 = Version(pd.__version__) >= Version("1.5.0")
 PANDAS_GE_20 = Version(pd.__version__) >= Version("2.0.0")
 PANDAS_GE_21 = Version(pd.__version__) >= Version("2.1.0")
-PANDAS_GE_22 = Version(pd.__version__) >= Version("2.2.0.dev0")
+PANDAS_GE_22 = Version(pd.__version__) >= Version("2.2.0")
+PANDAS_GE_30 = Version(pd.__version__) >= Version("3.0.0.dev0")
 
 
 # -----------------------------------------------------------------------------


Test patch:
diff --git a/geopandas/tests/test_dissolve.py b/geopandas/tests/test_dissolve.py
index 68412248..dcc961aa 100644
--- a/geopandas/tests/test_dissolve.py
+++ b/geopandas/tests/test_dissolve.py
@@ -9,7 +9,7 @@ from geopandas import GeoDataFrame, read_file
 from pandas.testing import assert_frame_equal
 import pytest
 
-from geopandas._compat import PANDAS_GE_15, PANDAS_GE_20
+from geopandas._compat import PANDAS_GE_15, PANDAS_GE_20, PANDAS_GE_30
 from geopandas.testing import assert_geodataframe_equal, geom_almost_equals
 
 
@@ -260,6 +260,7 @@ def test_dissolve_categorical():
 
     # when observed=False we get an additional observation
     # that wasn't in the original data
+    none_val = "GEOMETRYCOLLECTION EMPTY" if PANDAS_GE_30 else None
     expected_gdf_observed_false = geopandas.GeoDataFrame(
         {
             "cat": pd.Categorical(["a", "a", "b", "b"]),
@@ -267,7 +268,7 @@ def test_dissolve_categorical():
             "geometry": geopandas.array.from_wkt(
                 [
                     "MULTIPOINT (0 0, 1 1)",
-                    None,
+                    none_val,
                     "POINT (2 2)",
                     "POINT (3 3)",
                 ]
diff --git a/geopandas/tests/test_pandas_methods.py b/geopandas/tests/test_pandas_methods.py
index 7014b761..8d392a7f 100644
--- a/geopandas/tests/test_pandas_methods.py
+++ b/geopandas/tests/test_pandas_methods.py
@@ -749,6 +749,7 @@ def test_apply_loc_len1(df):
     np.testing.assert_allclose(result, expected)
 
 
+@pytest.mark.skipif(compat.PANDAS_GE_30, reason="convert_dtype is removed in pandas 3")
 def test_apply_convert_dtypes_keyword(s):
     # ensure the convert_dtypes keyword is accepted
     if not compat.PANDAS_GE_21:
Repository: geopandas/geopandas
Pull request #3356 (2024-06-26 08:44:16)

DOC: Fix small typos in `io.file`
Tiny typo fix. 

I saw this as an error message and spotted the typo. 

I didn't update the changelog as I assume this is too small to track. 


Patch:
diff --git a/geopandas/io/file.py b/geopandas/io/file.py
index 129f0f73..37aa3038 100644
--- a/geopandas/io/file.py
+++ b/geopandas/io/file.py
@@ -739,7 +739,7 @@ def _to_file_pyogrio(df, filename, driver, schema, crs, mode, metadata, **kwargs
         kwargs["append"] = True
 
     if crs is not None:
-        raise ValueError("Passing 'crs' it not supported with the 'pyogrio' engine.")
+        raise ValueError("Passing 'crs' is not supported with the 'pyogrio' engine.")
 
     # for the fiona engine, this check is done in gdf.iterfeatures()
     if not df.columns.is_unique:


Test patch:
diff --git a/geopandas/io/tests/test_file.py b/geopandas/io/tests/test_file.py
index d374d4d6..014b1f3c 100644
--- a/geopandas/io/tests/test_file.py
+++ b/geopandas/io/tests/test_file.py
@@ -462,7 +462,7 @@ def test_to_file_crs(tmpdir, engine, nybb_filename):
     assert result.crs == df.crs
 
     if engine == "pyogrio":
-        with pytest.raises(ValueError, match="Passing 'crs' it not supported"):
+        with pytest.raises(ValueError, match="Passing 'crs' is not supported"):
             df.to_file(tempfilename, crs=3857, engine=engine)
         return