我尝试使用'for'来更新pandas DataFrame(第9列)中的值:
k=1
for index, row in stations.iterrows():
if np.isnan(row.label):
p1 = Polygon([(row.long, row.lat),(row.long1, row.lat1),(row.long2, row.lat2)])
stations.iloc[index, 9] = k
for index1, row1 in stations[(index+1):min((index+10), len(stations))].iterrows():
p2 = Polygon([(row1.long, row1.lat),(row1.long1, row1.lat1),(row1.long2, row1.lat2)])
if p1.intersects(p2):
stations.iloc[index1, 9] = k
k = k + 1
但是当我在结果DataFrame站上看到时,我发现它没有被第二个圆圈改变... 你能帮帮我吗?
所以,数据的例子: