# Build dataframe from Dict

**URL:** <https://discourse.julialang.org/t/build-dataframe-from-dict/28538>\
**Category:** New to Julia\
**Tags:** dictionary, dataframes\
**Created:** [September 8, 2019, 11:52am UTC](https://discourse.julialang.org/t/build-dataframe-from-dict/28538 "2019-09-08T11:52:22Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![hasanOryx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hasanoryx/32/5373_2.png) [@hasanOryx](https://discourse.julialang.org/u/hasanOryx)\
**Post date:** [September 8, 2019, 4:01pm UTC](https://discourse.julialang.org/t/build-dataframe-from-dict/28538/5 "2019-09-08T16:01:59Z")

</div>

[quote=“hasanOryx, post:3, topic:28538”] @kevbonham  
I’ll give it a try  
[/quote]

The DataFrame appeared in a weird way:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/e/7ed52b4ce3812cf893bee00def56f48188616047.png)

To simplify the data, I re-wrote the example as below:

```julia
fruits = ["apple", "orange", "banana"]
fruits_matrix = Dict(fruits .=> false)
purchase_fruits = ["apple", "banana"]
available_fruits = Dict{String, Dict{String, Bool}}()
push!(available_fruits, "home" => fruits_matrix)
for (key, value) in available_fruits["home"]
   for entry in purchase_fruits
         if key == entry
            available_fruits["home"][key] = true
        end  
    end
end 
@show available_fruits
#=
available_fruits = Dict("home" => 
               Dict("orange" => 0,"banana" => 1,"apple" => 1))
Dict{String,Dict{String,Bool}} with 1 entry:
  "home" => Dict("orange"=>0,"banana"=>1,"apple"=>1)
=#
using DataFrames
DataFrame(available_fruits)

```

The result appeared as:

![image](https://global.discourse-cdn.com/julialang/original/3X/f/4/f4ca996e730b5d3ad0f6dfb06aa7d196aa94954e.png)

While I’m expecting something like:

![image](https://global.discourse-cdn.com/julialang/original/3X/1/c/1ccc8603d5af14c9ee5c4beb0fef018f71d71b37.png)

---

_[View the full topic](https://discourse.julialang.org/t/build-dataframe-from-dict/28538)._
