# Iterating through all possibilities

**URL:** <https://discourse.julialang.org/t/iterating-through-all-possibilities/49060>\
**Category:** General Usage\
**Tags:** question, dataframes\
**Created:** [October 26, 2020, 5:35pm UTC](https://discourse.julialang.org/t/iterating-through-all-possibilities/49060 "2020-10-26T17:35:59Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [October 26, 2020, 5:49pm UTC](https://discourse.julialang.org/t/iterating-through-all-possibilities/49060/2 "2020-10-26T17:49:39Z")

</div>

Welcome to the Julia community! First, it’s best to format your code output with backticks ``` like this:

```julia
julia> dfV = DataFrame(
           pt1 = rand(1.0:0.01:99.00, 10),
           pt2 = rand(-99.0:0.01:-1.0, 10)
       )
10×2 DataFrame
│ Row │ pt1 │ pt2 │
│ │ Float64 │ Float64 │
├─────┼─────────┼─────────┤
│ 1 │ 61.91 │ -67.4 │
│ 2 │ 58.66 │ -2.84 │
│ 3 │ 67.24 │ -74.39 │
│ 4 │ 88.18 │ -5.67 │
│ 5 │ 56.37 │ -61.79 │
│ 6 │ 82.63 │ -87.87 │
│ 7 │ 12.39 │ -83.12 │
│ 8 │ 20.24 │ -97.55 │
│ 9 │ 62.59 │ -42.87 │
│ 10 │ 95.64 │ -12.08 │

```

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](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757/14).

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:

```julia
for row in eachrow(dfV)
    # do something here...
end

```

If you need to do some sort of nested iteration, you can do:

```julia
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](https://github.com/JuliaStats/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.

---

_[View the full topic](https://discourse.julialang.org/t/iterating-through-all-possibilities/49060)._
