You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above code sample works with pandas 2.1.4, but with pandas 2.2.0 I get:
AttributeError: You are calling a geospatial method on the GeoDataFrame, but the active geometry column to use has not been set.
There are no existing columns with geometry data type. You can add a geometry column as the active geometry column with df.set_geometry.
Expected Output
There should be no exception without prior deprecation warnings.
This seems to be a regression on the pandas side in its from_records method in pandas 2.2 (I will open a report upstream). We could maybe fix it on our side short term by overriding from_records.
It looks a bit duplicative, but as a quick workaround to let your code work as before, you can pass the result once more to GeoDataFrame(..):
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of geopandas.
(optional) I have confirmed this bug exists on the main branch of geopandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
The above code sample works with pandas 2.1.4, but with pandas 2.2.0 I get:
Expected Output
There should be no exception without prior deprecation warnings.
Output of
geopandas.show_versions()
SYSTEM INFO
python : 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:12:31) [Clang 14.0.6 ]
executable : /opt/homebrew/Caskroom/miniforge/base/bin/python3.10
machine : macOS-14.2.1-arm64-arm-64bit
GEOS, GDAL, PROJ INFO
GEOS : 3.11.2
GEOS lib : None
GDAL : 3.6.4
GDAL data dir: /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/fiona/gdal_data
PROJ : 9.2.1
PROJ data dir: /opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/pyproj/proj_dir/share/proj
PYTHON DEPENDENCIES
geopandas : 0.14.2
numpy : 1.23.5
pandas : 2.2.0
pyproj : 3.6.0
shapely : 2.0.2
fiona : 1.9.4.post1
geoalchemy2: None
geopy : None
matplotlib : 3.7.1
mapclassify: None
pygeos : None
pyogrio : None
psycopg2 : None
pyarrow : None
rtree : 1.0.1
The text was updated successfully, but these errors were encountered: