# How to make dataframe from output of loop

**URL:** <https://discourse.julialang.org/t/how-to-make-dataframe-from-output-of-loop/51587>\
**Category:** General Usage\
**Tags:** dataframes\
**Created:** [December 10, 2020, 5:11am UTC](https://discourse.julialang.org/t/how-to-make-dataframe-from-output-of-loop/51587 "2020-12-10T05:11:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sai\_matcha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sai_matcha/32/35801_2.png) [@sai\_matcha](https://discourse.julialang.org/u/sai_matcha)\
**Post date:** [December 10, 2020, 5:11am UTC](https://discourse.julialang.org/t/how-to-make-dataframe-from-output-of-loop/51587/1 "2020-12-10T05:11:36Z")

</div>

data i have

```julia
a = (0:1:160)
conc = (for i in a 
              println(1.05*exp(-0.0228*i))
end

```

i want to get dataframe with “a” and “conc” columns

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [December 10, 2020, 5:54am UTC](https://discourse.julialang.org/t/how-to-make-dataframe-from-output-of-loop/51587/2 "2020-12-10T05:54:10Z")

</div>

please at least read the “getting started” part of the documentation:  
[https://dataframes.juliadata.org/stable/man/getting\_started/#Constructing-Column-by-Column](https://dataframes.juliadata.org/stable/man/getting_started/#Constructing-Column-by-Column)

```julia
julia> a = 0:160;

julia> conc = 1.05*exp.(-0.0228 .* a);

julia> df = DataFrame(; a, conc)
161×2 DataFrame
 Row │ a conc
     │ Int64 Float64
─────┼──────────────────
   1 │ 0 1.05
   2 │ 1 1.02633
...

```
