to_geopandas#

GeosDataFrameAccessor.to_geopandas(geometry=None, crs=None)#

Transform a pandas DataFrame with (at least) a “geos” dtype column to a geopandas.GeoDataFrame.

Parameters:
  • geometry (string, optional) – Name of the column to use as geometry; Default Infer if there is only one geos column

  • crs (any, optional) – CRS to use with GeoPandas, check the docs for more information; Default None

Returns:

The geopandas dataframe.

Return type:

geopandas.GeoDataFrame

Raises:
  • ImportError – Geopandas is not installed.

  • AttributeError – There are no geos dtype columns in the dataframe.

  • TypeError – “geometry” column is not of geos dtype.

  • ValueError – No “geometry” was passed, but there are multiple “geos” column so we cannot automatically infer.

Note

This function always returns a copy of the original data.