Note: The V dataframe is structured the same way, except called EastingV and NorthingV respectively
and I want to output the final dataframe with these columns, but want to make sure there are no duplicate line segments (ie 1 --> 2 is the same as 2 --> 1
||Point A |Point B| EuclideanDist(S Points)| EuclideanDist(V Points)|
| — | — | — | — |
||String|String|Float64|…|Float64|
|1|2||EuclideanDist(1s to 2s)|EucliudeanDist(1v to 2v)||
…
I have tried using dataframes to iterate through each column as well as the following
@inbounds for i in eachindex(dfV, dfV2)
dfV[i] = euclidean(dfV[i], dfV[i])
end
any help would be appreciated! I am fairly new to Julia
You should be able to copy/paste directly from your REPL this way and it’s much easier to see what’s going on. You should also check out this thread.
I’m not 100% certain as to what it is you’re trying to do but for iterating over the rows of a DataFrame you can just do:
for row in eachrow(dfV)
# do something here...
end
If you need to do some sort of nested iteration, you can do:
for vrow in eachrow(dfV), srow in eachrow(dfS)
# do something here...
end
It looks like you’re just trying to compute the Euclidean distance between points and I suspect there is a better way of approaching the problem. Distances.jl exports a colwise function as well as a pairwise function so I would probably check those out to see if they do what you need them to.
I agree this post wasnt as easy to help as I had planned! The formatting notes are very helpful, and I was having trouble abstracting the issue i was describing. I made it work with your solution though, thanks for your help and guidance! I will try to make better questions in the future!