from pyogrio import read_dataframe, write_dataframe import geopandas as gpd import pandas as pd from joblib import Parallel, delayed def process_file(i, grid, grid_spatial_index): crimin_data = read_dataframe(f"DATA/refined/geopackage/범죄주의구역_가공/범죄주의구역-경북{i+1}.gpkg") crimin_data = crimin_data.to_crs("EPSG:5179") crimin_data_sindex = crimin_data.sindex crimin_overlap = grid.overlay(crimin_data, how="intersection") write_dataframe(crimin_overlap,f"DATA/refined/geopackage/범죄주의구역_가공/범죄주의구역-경북-격자{i+1}.gpkg") grid = read_dataframe("DATA/refined/geopackage/시군구읍면동_경상북도_100x100.gpkg") grid_spatial_index = grid.sindex print("grid_loaded!") Parallel(n_jobs=-1)(delayed(process_file)(i, grid) for i in range(10))