How do I export a geopandas file, like how you would a csv file?

Question, how do I export a geopandas file, like how you would a csv file? I know df.to_csv() is god for csvs is there an equivalent for geopandas files you altered or created?


This topic was automatically generated from Slack. You can find the original thread here.

to_file() is what you want. You can specify any number of spatial data formats.

https://geopandas.org/docs/user_guide/io.html#writing-spatial-data

TypeError: Cannot interpret '<geopandas.array.GeometryDtype object at 0x000002187E52D4F0>' as a data type

is the error I get

ct_data.to_file(“data/geospatial/censustract/updated_tl_2019_06_tract.shp”, driver=“GeoJSON”)

you’re trying to write a shapefile while using the geojson driver

try just removing the driver = 'GeoJSON' argument entirely?

I did that and I still got an error

that is disappointing

and the df is a GeoDataFrame?

(I’m stepping away from my desk for the evening but I’ll try to help you out if you need when I get back)

actually, its a shapefile

what do you see when you run type(df)?