I have a dataset like this
| FID | osmid | s | e | seg_length |
|---|---|---|---|---|
| 0 | 4999 | 733 | 99 | 7.7 |
| 1 | 566 | 733 | 33 | 3.2 |
| 2 | 499 | 713 | 96 | 7.7 |
| 3 | 56 | 783 | 32 | 3.5 |
| 4 | 409 | 783 | 98 | 7.6 |
| 5 | 516 | 736 | 38 | 3.5 |
| 6 | 459 | 739 | 98 | 7.7 |
| 7 | 526 | 731 | 33 | 3.2 |
s stands for starting work and e for ending point. Some FID share the same start and end point. I want to keep only one start and end point for every point so when two starting point are shared I want to keep only these with the shortest seg_length. I could'nt find a good code for that. Every end and start point should only have one unique value.
For example FID 0 and 1 share the same starting point and in the new dataset only FID 1 should be there. Also FID 4 and FID 6 share the same end point and in the new dataset only 4 should be there.