JuJuKwakKwak

GeoPandas) shp 파일 불러오고 새로운 열 생성하고 저장하기 본문

Data Science/코드 관련 모음

GeoPandas) shp 파일 불러오고 새로운 열 생성하고 저장하기

jujukwakkwak 2022. 9. 15. 16:25
import os
import geopandas as gpd
for f_name in os.listdir('./'):
    if f_name.endswith('.shp'):
        shp_file = gpd.read_file(f_name, encoding='utf-8')
        shp_file['열'].fillna(0.0, inplace=True)
        shp_file['새로운 열'] = shp_file['열'] / 100.0
        shp_file.to_file('새로운 파일 이름.shp')