I\'m trying to combine multiple shapefiles by implementing the follwing:
import geopandas as gpd
import pandas as pd
for i in range(10,56):
interesting_file
If using pandas.concat like the answer of @Paul H, some geographical imformation such as coordinate reference system(crs) does not get preserved by default. But it worked when using the way like below:
import os
import geopandas as gpd
file = os.listdir("Your folder")
path = [os.path.join("Your folder", i) for i in file if ".shp" in i]
gdf = gpd.GeoDataFrame(pd.concat([gpd.read_file(i) for i in path],
ignore_index=True), crs=gpd.read_file(path[0]).crs)
In this way, the geodataframe will have CRS as your need
I can't test this since I don't have your data, but you want something like this (assuming python 3):
from pathlib import Path
import pandas
import geopandas
folder = Path("/Users/m3105/Downloads/area")
shapefiles = folder.glob("tl_2015_*_arealm.shp")
gdf = pandas.concat([
geopandas.read_file(shp)
for shp in shapefiles
]).pipe(geopandas.GeoDataFrame)
gdf.to_file(folder / 'compiled.shp')