I am trying to load table (from Postgres DB) with GEOMETRY column to Pandas DataFrame using pd.read_sql_table method. I am getting error becuase GEOMETRY type seem to be not supported:

C:\Anaconda3\lib\site-packages\sqlalchemy\dialects\postgresql\base.py:3010: SAWarning: Did not recognize type 'geometry' of column 'geometry' "Did not recognize type '%s' of column '%s'" % (attype, name)

Does anyone knows how to load such data to Pandas df? On Pandas Doc page for "read_sql_table" I don't see options to define data type.

1 Answer 1


GeoPandas adds spatial datatypes/methods to pandas. I would install that and use the from_postgis method:

import geopandas as gpd
sql = "SELECT ST_asBinary(geom) AS geom, highway FROM roads"
df = gpd.GeoDataFrame.from_postgis(sql, con)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.