# How can I make an Array{Array{Float64,1},1} out of two columns of a dataframe?

**URL:** <https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489>\
**Category:** New to Julia\
**Tags:** array, dataframes\
**Created:** [July 3, 2020, 7:57pm UTC](https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489 "2020-07-03T19:57:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gedankenexperiment](https://avatars.discourse-cdn.com/v4/letter/g/a183cd/32.png) [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Post date:** [July 3, 2020, 7:57pm UTC](https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489/1 "2020-07-03T19:57:05Z")

</div>

I have a dataframe with two columns x,y of type Float. I want to apply the `concave_hull()` function of the `ConcaveHull` package on those columns. But it prefers a `[[1.0,2.0],[3.0,4.0],...]` object. How can I now convert the columns to that object? I’ve struggled quite a bit with this. Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [July 3, 2020, 8:36pm UTC](https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489/2 "2020-07-03T20:36:17Z")

</div>

```julia
collect(eachcol(df))

```

---

<div class="post-metadata">

**Author:** ![gedankenexperiment](https://avatars.discourse-cdn.com/v4/letter/g/a183cd/32.png) [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Post date:** [July 3, 2020, 8:44pm UTC](https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489/3 "2020-07-03T20:44:04Z")

</div>

Hmm… unfortunately this gives me sth else…

```julia
df = DataFrame(x=rand(10) , y=rand(10));
collect(eachcol(df))

```

gives a `2-element Array{AbstractArray{T,1} where T,1}`, but not the required `10-element Array{Array{Float64,1},1}`…

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [July 3, 2020, 9:10pm UTC](https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489/4 "2020-07-03T21:10:42Z")

</div>

The poor man’s way works fine if this is the only time you need it: `[df.x, df.y]`

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [July 3, 2020, 9:20pm UTC](https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489/5 "2020-07-03T21:20:59Z")

</div>

Ah sorry you want

```julia
julia> collect.(eachrow(df))

```

---

<div class="post-metadata">

**Author:** ![gedankenexperiment](https://avatars.discourse-cdn.com/v4/letter/g/a183cd/32.png) [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Post date:** [July 4, 2020, 6:59am UTC](https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489/8 "2020-07-04T06:59:14Z")

</div>

Okay, I found a (poor man’s) way:

```julia
df = DataFrame(x=rand(10) , y=rand(10));

[[df.x[i],df.y[i]] for i in 1:nrow(df)]

```

… gives me a `10-element Array{Array{Float64,1},1}`

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [July 4, 2020, 4:58pm UTC](https://discourse.julialang.org/t/how-can-i-make-an-array-array-float64-1-1-out-of-two-columns-of-a-dataframe/42489/9 "2020-07-04T16:58:56Z")

</div>

Did you try `collect.(eachrow(df))`?

```julia
julia> df = DataFrame(x = rand(10), y = rand(10));

julia> collect.(eachrow(df))
10-element Array{Array{Float64,1},1}:
 [0.35424724279497966, 0.4697299328665443]
 [0.36738913473583823, 0.9304579561346957]
 [0.005508085955786779, 0.567222362963131]
 [0.5482079525456292, 0.5794345832007906]
 [0.9080293755772335, 0.11550368172702608]
 [0.8068866112091113, 0.22230162714717272]
 [0.9464827600585084, 0.4709336111872562]
 [0.9161280652731476, 0.8620815301389604]
 [0.5261048454418709, 0.20695828316038356]
 [0.6150559269084683, 0.9246450679267724]

```
