Skip to content
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

TST/COMPAT: Ignore int64 vs int_nativesize mismatches introduced by pandas 2.x #3189

Open
sebastic opened this issue Feb 17, 2024 · 2 comments
Labels

Comments

@sebastic
Copy link

Rebecca N. Palmer provided a patch for the Debian package in Debian Bug #1063435 for compatibility with pandas 2.x:

Description: Ignore int64 vs int_nativesize mismatches
 Introduced by pandas 2.x
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Bug-Debian: https://bugs.debian.org/1063435

--- a/geopandas/tests/test_geom_methods.py
+++ b/geopandas/tests/test_geom_methods.py
@@ -1384,7 +1384,7 @@ class TestGeomMethods:
            names=[index_name, None],
        )
        expected_df = expected_df.set_index(expected_index)
-        assert_frame_equal(test_df, expected_df)
+        assert_frame_equal(test_df, expected_df, check_index_type=False)

    @pytest.mark.parametrize("index_name", [None, "test"])
    def test_explode_geodataframe_level_1(self, index_name):
@@ -1403,7 +1403,7 @@ class TestGeomMethods:
            names=[index_name, None],
        )
        expected_df = expected_df.set_index(expected_index)
-        assert_frame_equal(test_df, expected_df)
+        assert_frame_equal(test_df, expected_df, check_index_type=False)

    @pytest.mark.parametrize("index_name", [None, "test"])
    def test_explode_geodataframe_no_multiindex(self, index_name):
@@ -1509,7 +1509,7 @@ class TestGeomMethods:
            names=["first", "second", None],
        )
        expected_df = expected_df.set_index(expected_index)
-        assert_frame_equal(test_df, expected_df)
+        assert_frame_equal(test_df, expected_df, check_index_type=False)

    @pytest.mark.parametrize("outer_index", [1, (1, 2), "1"])
    def test_explode_pandas_multi_index_false(self, outer_index):
@@ -1610,7 +1610,7 @@ class TestGeomMethods:
            geometry=expected_geometry,
            index=expected_index,
        )
-        assert_geodataframe_equal(test_df, expected_df)
+        assert_geodataframe_equal(test_df, expected_df, check_index_type=False)

    def test_explode_order_no_multi(self):
        df = GeoDataFrame(
@@ -1628,7 +1628,7 @@ class TestGeomMethods:
            geometry=[Point(0, x) for x in range(3)],
            index=expected_index,
        )
-        assert_geodataframe_equal(test_df, expected_df)
+        assert_geodataframe_equal(test_df, expected_df, check_index_type=False)

    def test_explode_order_mixed(self):
        df = GeoDataFrame(
@@ -1656,7 +1656,7 @@ class TestGeomMethods:
            geometry=expected_geometry,
            index=expected_index,
        )
-        assert_geodataframe_equal(test_df, expected_df)
+        assert_geodataframe_equal(test_df, expected_df, check_index_type=False)

    def test_explode_duplicated_index(self):
        df = GeoDataFrame(
@@ -1684,7 +1684,7 @@ class TestGeomMethods:
            geometry=expected_geometry,
            index=expected_index,
        )
-        assert_geodataframe_equal(test_df, expected_df)
+        assert_geodataframe_equal(test_df, expected_df, check_index_type=False)

    @pytest.mark.parametrize("geom_col", ["geom", "geometry"])
    def test_explode_geometry_name(self, geom_col):
@@ -1806,7 +1806,7 @@ class TestGeomMethods:
                ]
            ),
        )
-        assert_frame_equal(self.g11.get_coordinates(index_parts=True), expected)
+        assert_frame_equal(self.g11.get_coordinates(index_parts=True), expected, check_index_type=False)

    @pytest.mark.skipif(
        (compat.USE_PYGEOS or compat.USE_SHAPELY_20),
@martinfleis
Copy link
Member

Thanks for heads up! Is there an easy way for us to reproduce the issue? Or at least see some logs where this showed up?

@martinfleis martinfleis changed the title BUG: Ignore int64 vs int_nativesize mismatches introduced by pandas 2.x TST/COMPAT: Ignore int64 vs int_nativesize mismatches introduced by pandas 2.x Mar 11, 2024
@sebastic
Copy link
Author

You should be able to reproduce it on 32-bit systems like i386, e.g.:

https://ci.debian.net/packages/p/python-geopandas/testing/i386/43111227/

Rebecca noticed the issue on armhf, from the Debian Bug report:

In pandas 2.x (now in unstable), there are a few places where geopandas
uses native-size int but the plain pandas objects used as test
references are always int64, failing the test:

https://ci.debian.net/packages/p/python-geopandas/testing/armhf/42777226/

Probably a reasonable response is to ignore this
(check_index_type=False/check_dtype=False) but I haven't looked carefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants