Geopandas: how to read a csv and convert to a geopandas dataframe with polygons?

Geopandas seems to be unable to convert a geometry column from a pandas dataframe.

Solution number 2

Try applying the shapely wkt.loads function on your column before converting your dataframe to a geodataframe.

from shapely import wkt

df['geometry'] = df['geometry'].apply(wkt.loads)
gdf = gpd.GeoDataFrame(df, crs="epsg:4326")

Good luck!


Do not use – crashes spyder and jupyter kernel for some people

Solution number 1: Try loading the csv directly with geopandas

gdf = gpd.read_file('myFile.csv')
gdf.crs="epsg:4326"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)