I have a list of dataframes, all of the same structure and all are polygons.
How can I add them all together using geopandas?
I have a list of dataframes, all of the same structure and all are polygons.
How can I add them all together using geopandas?
it seems that this is the right way to do that right now:
rdf = gpd.GeoDataFrame( pd.concat( dataframesList, ignore_index=True) )
I just experimented with this - maybe in GeoPandas 0.2.1 and Pandas 0.20.3 it is a bit more concise:
gdf = pd.concat([gdf1, gdf2])
gdf is automatically created as a GeoDataFrame. Of course if there is a chance of conflicting indices you'll want to keep the 'ignore_index=True' parameter.
gdf1.to_file(xxx, driver='ESRI Shapefile') you will get an error which says 'DataFrame' object has no attribute 'to_file'
– jberrio
Jul 18 '18 at 00:48
rdf = gpd.GeoDataFrame(pd.concat(dataframesList, ignore_index=True), crs=dataframesList[0].crs).Now new dataframe will also have the same CRS as one of the initial dataframes. Because of using
– AleksMat Sep 12 '18 at 16:44pandas.concatany geographical metadata such as CRS does not get preserved by default.