Repository: geopandas/geopandas

Issue:
BUG: Creating geoseries from series fails if CRS is passed in
```python
import pandas as pd
import geopandas as gpd

ser = gpd.GeoSeries.from_xy([0,1], [1,2], crs="EPSG:4326")
ser2 = pd.Series(ser)
assert ser2.array.crs == "EPSG:4326"
gpd.GeoSeries(ser2, crs="EPSG:4326")
Traceback (most recent call last):
  File "C:\Users\matt.richards\AppData\Roaming\JetBrains\PyCharmCE2024.1\scratches\scratch_48.py", line 8, in <module>
    gpd.GeoSeries(ser2, crs="EPSG:4326")
  File "C:\Users\matt.richards\.conda\envs\gtfs-to-zenith\lib\site-packages\geopandas\geoseries.py", line 167, in __init__
    if not data.crs == crs:
  File "C:\Users\matt.richards\.conda\envs\gtfs-to-zenith\lib\site-packages\pandas\core\generic.py", line 6299, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'crs'
```

This is a regression in 1.0 from #2858, else clause should use `data_crs` as well. This seems like it might be worthwhile fixing in a bugfix release


Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 51217980..89da9029 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@
 Bug fixes:
 
 - Properly support named aggregations over a geometry column in `GroupBy.agg` (#3368).
+- Fix regression where constructing a GeoSeries from a pd.Series with GeometryDtype values 
+  failed when `crs` was provided(#3383).
+
+Deprecations and compatibility notes:
+
+- The `GeoSeries.select` method wrapping the pandas `Series.select` method has been removed.
+  The upstream method no longer exists in all supported version of pandas (#3394).
 
 ## Version 1.0.1 (July 2, 2024)
 
diff --git a/doc/source/conf.py b/doc/source/conf.py
index da5107a5..2f55e987 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -246,6 +246,13 @@ html_additional_pages = {page[0]: "redirect.html" for page in moved_pages}
 
 html_context = {"redirects": {old: new for old, new in moved_pages}}
 
+# Define the canonical URL if you are using a custom domain on Read the Docs
+html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
+
+# Tell Jinja2 templates the build is running on Read the Docs
+if os.environ.get("READTHEDOCS", "") == "True":
+    html_context["READTHEDOCS"] = True
+
 # If false, no module index is generated.
 # html_domain_indices = True
 
diff --git a/geopandas/geoseries.py b/geopandas/geoseries.py
index ea30f61d..4eaa4d3a 100644
--- a/geopandas/geoseries.py
+++ b/geopandas/geoseries.py
@@ -164,7 +164,7 @@ class GeoSeries(GeoPandasBase, Series):
                 # make a copy to avoid setting CRS to passed GeometryArray
                 data = data.copy()
             else:
-                if not data.crs == crs:
+                if not data_crs == crs:
                     raise ValueError(
                         "CRS mismatch between CRS of the passed geometries "
                         "and 'crs'. Use 'GeoSeries.set_crs(crs, "
@@ -734,10 +734,6 @@ class GeoSeries(GeoPandasBase, Series):
     def take(self, *args, **kwargs):
         return self._wrapped_pandas_method("take", *args, **kwargs)
 
-    @doc(pd.Series)
-    def select(self, *args, **kwargs):
-        return self._wrapped_pandas_method("select", *args, **kwargs)
-
     @doc(pd.Series)
     def apply(self, func, convert_dtype: Optional[bool] = None, args=(), **kwargs):
         if convert_dtype is not None:


Test patch:
diff --git a/geopandas/tests/test_geoseries.py b/geopandas/tests/test_geoseries.py
index 39590176..4d2e2b54 100644
--- a/geopandas/tests/test_geoseries.py
+++ b/geopandas/tests/test_geoseries.py
@@ -673,6 +673,16 @@ class TestConstructor:
         assert gs.crs is None
         assert result.crs == "EPSG:4326"
 
+        # https://github.com/geopandas/geopandas/issues/3382
+        s2 = pd.Series(gs.set_crs("EPSG:4326"))
+        result = GeoSeries(s2, crs=4326)
+        assert result.crs == "EPSG:4326"
+        with pytest.raises(
+            ValueError,
+            match="CRS mismatch between CRS of the passed geometries and 'crs'",
+        ):
+            GeoSeries(s2, crs=4283)
+
     def test_copy(self):
         # default is to copy with CoW / pandas 3+
         arr = np.array([Point(x, x) for x in range(3)], dtype=object)