# How to create a DataFrame from 1×24×24 Array{Float64, 3}

**URL:** <https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041>\
**Category:** General Usage\
**Tags:** dataframes\
**Created:** [May 29, 2021, 2:21pm UTC](https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041 "2021-05-29T14:21:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [May 29, 2021, 2:21pm UTC](https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041/1 "2021-05-29T14:21:01Z")

</div>

Hi. I have a matrix named “cycles” which is a 72×24 Matrix{Float64}. I want to obtain a cross-correlation matrix associated with its 24 columns. No problem with this:

```julia
Cross_Corr_matrix = crosscor(cycles[:,:],cycles[:,:], [0]; demean=true)

```

which provides the following output:

```julia
1×24×24 Array{Float64, 3}:
[:, :, 1] =
 1.0 0.216743 -0.0920911 -0.00388045 … 0.0603473 0.0339215 0.0944969

[:, :, 2] =
 0.216743 1.0 0.0569839 0.293187 … 0.429425 0.478719 0.534698

[:, :, 3] =
 -0.0920911 0.0569839 1.0 0.246218 … 0.0632372 -0.180101 0.303093

...

[:, :, 22] =
 0.0603473 0.429425 0.0632372 0.25062 … 0.517531 1.0 0.49417 0.524282

[:, :, 23] =
 0.0339215 0.478719 -0.180101 … 0.407871 0.49417 1.0 0.448303

[:, :, 24] =
 0.0944969 0.534698 0.303093 … 0.343121 0.524282 0.448303 1.0

```

**My question is: how can I transform this output into a data frame?**

I tried:

```julia
df_corr = DataFrame(Cross_Corr_matrix)

```

which produced the following error:

```julia
LoadError: ArgumentError: 'Array{Float64, 3}' iterates 'Float64' values, which doesn't satisfy the Tables.jl `AbstractRow` interface 
ArgumentError: 'Array{Float64, 3}' iterates 'Float64' values, which doesn't satisfy the Tables.jl `AbstractRow` interface

```

Help will be very much appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![AquaIndigo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquaindigo/32/15820_2.png) [@AquaIndigo](https://discourse.julialang.org/u/AquaIndigo)\
**Post date:** [May 29, 2021, 2:43pm UTC](https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041/2 "2021-05-29T14:43:31Z")

</div>

`reshape(cross_corr_matrix, 24, 24)` may help

---

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [May 29, 2021, 2:58pm UTC](https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041/3 "2021-05-29T14:58:00Z")

</div>

@AquaIndigo, thanks a lot. It’s so simple! Quite embarrassing after one spends two hours trying to figure out a solution and get none.

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [May 29, 2021, 3:13pm UTC](https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041/4 "2021-05-29T15:13:01Z")

</div>

Another way is `dropdims(cross_corr_matrix, dims=1)`, which will just call reshape but means you need not handle the sizes.

---

<div class="post-metadata">

**Author:** ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Post date:** [May 29, 2021, 4:53pm UTC](https://discourse.julialang.org/t/how-to-create-a-dataframe-from-1x24x24-array-float64-3/62041/5 "2021-05-29T16:53:25Z")

</div>

@mcabbott Thanks. It works and its simplicity is striking.
