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

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

%%time
edges = []
set_edges = set()

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

    start_point = points[points['feature_or'] == start_id].geometry.values[0]
    end_point = points[points['feature_or'] == end_id].geometry.values[0]
    
    start = points[points['feature_or'] == start_id]['MEDIAN_spe'].values[0]
    end = points[points['feature_or'] == end_id]['MEDIAN_spe'].values[0]
    
    start_source = points[points['feature_or'] == start_id]['MERGE_SRC'].values[0]
    end_source = points[points['feature_or'] == end_id]['MERGE_SRC'].values[0]
    
    start_lt = points[points['feature_or'] == start_id]['Landtype'].values[0]
    end_lt = points[points['feature_or'] == end_id]['Landtype'].values[0]

    if frozenset((start_id, end_id)) not in set_edges:
        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})
        set_edges.add(frozenset((start_id, end_id)))

    print(len(edges), start_id, end_id)

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

output_shapefile = r"C:\BAZA\COURSEWORK\GRID_1\with_dem\links_dem.shp"
edges_gdf.to_file(output_shapefile)

---------------------------------------------------------------------------
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