Данный код читает шейп-файл с точками и таблицу со списком ребер из этих точек, связывает таблицу с шейп-файлом по номеру (идентификатору точки), чтобы извлечь ее геометрию, построить ребро и добавить его в новый шейп-файл. Однако возникает ошибка, как ее решить?

path = r"C:\BAZA\COURSEWORK\GRID_1\with_dem\points_dem.shp"
points = gpd.read_file(path)
	FID_land_p	Landtype	Road_type	MEAN_speed	MEDIAN_spe	ELEV_DEM	MERGE_SRC	geometry	TARGET_FID
0	113	Залежь	None	3.312347	3.471036	162.055	land	POINT Z (329981.690 6119284.376 0.000)	1
1	113	Залежь	None	3.312347	3.471036	161.896	land	POINT Z (329986.690 6119284.376 0.000)	2
2	113	Залежь	None	3.312347	3.471036	161.719	land	POINT Z (329991.690 6119284.376 0.000)	3
3	113	Залежь	None	3.312347	3.471036	161.526	land	POINT Z (329996.690 6119284.376 0.000)	4
4	113	Залежь	None	3.312347	3.471036	161.318	land	POINT Z (330001.690 6119284.376 0.000)	5
5	113	Залежь	None	3.312347	3.471036	161.096	land	POINT Z (330006.690 6119284.376 0.000)	6
6	113	Залежь	None	3.312347	3.471036	160.853	land	POINT Z (330011.690 6119284.376 0.000)	7
7	113	Залежь	None	3.312347	3.471036	160.586	land	POINT Z (330016.690 6119284.376 0.000)	8
8	113	Залежь	None	3.312347	3.471036	160.294	land	POINT Z (330021.690 6119284.376 0.000)	9
9	113	Залежь	None	3.312347	3.471036	159.980	land	POINT Z (330026.690 6119284.376 0.000)	10

len(points)
814404

all_table_points = pd.read_pickle(r"C:\BAZA\COURSEWORK\GRID_1\with_dem\all_table_points.pkl")
OBJECTID	IN_FID	NEAR_FID	NEAR_DIST	NEAR_RANK
0	2	797613	797614	4.999981	1
1	3	797613	797612	5.000031	2
2	4	797614	797613	4.999981	1
3	5	797614	797615	5.000031	2
4	6	797615	797616	4.999981	1
5	7	797615	797614	5.000031	2
6	8	797616	797615	4.999981	1
7	9	797616	797617	5.000031	2
8	10	797617	797618	4.999940	1
9	11	797617	797616	5.000031	2

len(all_table_points)
6429638

table['FID_PAIR'] = table.apply(lambda row: tuple(sorted([row['IN_FID'], row['NEAR_FID']])), axis=1)

table_unique = table.drop_duplicates(subset=['FID_PAIR'])

table_unique.head(10)

OBJECTID	IN_FID	NEAR_FID	NEAR_DIST	NEAR_RANK	FID_PAIR
0	1	0	1	10.000000	1	(0.0, 1.0)
1	2	0	84	10.000000	1	(0.0, 84.0)
2	3	0	85	14.142136	2	(0.0, 85.0)
3	4	0	2	20.000000	3	(0.0, 2.0)
4	5	0	168	20.000000	3	(0.0, 168.0)
5	6	0	86	22.360680	4	(0.0, 86.0)
6	7	0	169	22.360680	4	(0.0, 169.0)
8	9	1	2	10.000000	1	(1.0, 2.0)
9	10	1	85	10.000000	1	(1.0, 85.0)
10	11	1	84	14.142136	2	(1.0, 84.0)

%%time
edges = []

for index, row in table_unique.iterrows():
    start_id, end_id, dist = row['IN_FID'], row['NEAR_FID'], row['NEAR_DIST']

    start_point = points[points['TARGET_FID'] == start_id].geometry.values[0]
    end_point = points[points['TARGET_FID'] == end_id].geometry.values[0]
    
    start = points[points['TARGET_FID'] == start_id]['land_avg_s'].values[0]
    end = points[points['TARGET_FID'] == end_id]['land_avg_s'].values[0]
    
    start_source = points[points['TARGET_FID'] == start_id]['Source'].values[0]
    end_source = points[points['TARGET_FID'] == end_id]['Source'].values[0]
    
    start_lt = points[points['TARGET_FID'] == start_id]['Landtype'].values[0]
    end_lt = points[points['TARGET_FID'] == end_id]['Landtype'].values[0]
    
    start_elev = points[points['TARGET_FID'] == start_id]['ELEV'].values[0]
    end_elev = points[points['TARGET_FID'] == end_id]['ELEV'].values[0]
    
    if start_lt == 'land' and end_lt == 'land':
        if dist == 22.36068:
            edge = LineString([start_point, end_point])
        elif dist <= 14.142136:
            edge = LineString([start_point, end_point])
        else:
            pass
    else:
        edge = LineString([start_point, end_point])

    edges.append({'geometry': edge, 'START_ID': start_id, 'END_ID': end_id,
                  'START_SPEED': start, 'END_SPEED': end, 'START_SOURCE': start_source, 'END_SOURCE': end_source, 
                  'LT1': start_lt, 'LT2': end_lt, 'ELEV1': start_elev, 'ELEV2': end_elev})
    
    print(len(edges))

edges_gdf = gpd.GeoDataFrame(edges, crs=points.crs)

output_shapefile = r"C:\BAZA\COURSEWORK\GRID_1\with_dem\knight_links_10m_dem_set.shp"
edges_gdf.to_file(output_shapefile, driver='ESRI Shapefile', encoding='UTF-8')

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
File <timed exec>:7

File ~\.conda\envs\ELZAS_LORAN\lib\site-packages\geopandas\array.py:384, in GeometryArray.__getitem__(self, idx)
    382 def __getitem__(self, idx):
    383     if isinstance(idx, numbers.Integral):
--> 384         return _geom_to_shapely(self._data[idx])
    385     # array-like, slice
    386     # validate and convert IntegerArray/BooleanArray
    387     # to numpy array, pass-through non-array-like indexers
    388     idx = pd.api.indexers.check_array_indexer(self, idx)

IndexError: index 0 is out of bounds for axis 0 with size 0