# Best practice for the conversion from a vector of dictionaries to a dataframe

**URL:** <https://discourse.julialang.org/t/best-practice-for-the-conversion-from-a-vector-of-dictionaries-to-a-dataframe/68244>\
**Category:** General Usage\
**Tags:** dictionary, dataframes\
**Created:** [September 16, 2021, 5:48am UTC](https://discourse.julialang.org/t/best-practice-for-the-conversion-from-a-vector-of-dictionaries-to-a-dataframe/68244 "2021-09-16T05:48:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iHany](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihany/32/18151_2.png) [@iHany](https://discourse.julialang.org/u/iHany)\
**Post date:** [September 16, 2021, 5:48am UTC](https://discourse.julialang.org/t/best-practice-for-the-conversion-from-a-vector-of-dictionaries-to-a-dataframe/68244/1 "2021-09-16T05:48:59Z")

</div>

I’d like to know whether there is a convenient way of converting from a vector of dictionaries to a dataframe. For example,

```julia
julia> my_dict = Dict("a" => [1, 2, 3], "b" => [4])
my_dictDict{String, Vector{Int64}} with 2 entries:
  "b" => [4]
  "a" => [1, 2, 3]

julia> my_dict_list = DrWatson.dict_list(my_dict)
3-element Vector{Dict{String, Int64}}:
 Dict("b" => 4, "a" => 1)
 Dict("b" => 4, "a" => 2)
 Dict("b" => 4, "a" => 3)

julia> df = DataFrame(my_dict_list) # something like this...?

```

---

<div class="post-metadata">

**Author:** ![iHany](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihany/32/18151_2.png) [@iHany](https://discourse.julialang.org/u/iHany)\
**Post date:** [September 16, 2021, 5:54am UTC](https://discourse.julialang.org/t/best-practice-for-the-conversion-from-a-vector-of-dictionaries-to-a-dataframe/68244/2 "2021-09-16T05:54:55Z")

</div>

I found the answer based on [this post](https://stackoverflow.com/questions/54168574/an-array-of-dictionaries-into-a-dataframe-at-one-go-in-julia).

```julia
julia> vcat(DataFrame.(my_dict_list)...)
3×2 DataFrame
 Row │ a b
     │ Int64 Int64
─────┼──────────────
   1 │ 1 4
   2 │ 2 4
   3 │ 3 4

```
