'Iterate rows and locking coordinates
I am kind of stuck here and I am not sure what I am doing wrong.
I have a df with columns "Latitude", "Longitude", however with important indexes. My plan is to lock first row coordinates [Latitude, Longitude] as X, perform formula Y, and do * some other stuff* with the result. Then I want to lock second row as X, perform Y, third row etc.
Latitude Longitude
3 54.0 130.2
8 53.5 -125.2
9 65.0 120.45
As I am a newbie, I tried to use basic For loop and iloc but I managed only to capture index, but not coordinates.
I would need to capture coordinates [Latitude, Longitude] and iterate that for every row.
Also, after doing some other stuff with values, I want to put these resulting values back in new df with same order (row and index order as above). I am not sure how to approach this part too.
Thank you for your help.
EDIT: I have been ask to provide the code.
for i in df.index:
i==0
d.loc[i]
i=i+1
This is what I had when i asked the question. Tried to figure out how to capture/print the values (coordinates) but unsuccessfully. This code was also before I figured out I will need original indexes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
