3 level dictionary to dataframe in Python
<p>I have a 3 level dictionary, which I need to convert to a dataframe in Python. 
I am fairly new to python and tried to run a loop in loop to write the file in a dataframe but doesn't give me the required output.</p>

<p>The current dictionary format:
<a href="http://i.stack.imgur.com/UZmbj.png" rel="nofollow">enter image description here</a></p>

<p>Required dataframe:
<a href="http://i.stack.imgur.com/swGxe.png" rel="nofollow">enter image description here</a></p>

<p>Any help will be really appreciated!</p>

<p>Dictionary:</p>

<pre><code>{
    "60354": [
        {
            "http://www.aaaaaaaaaaaaaaaaaaaa.com": [
                {
                    "Garden fresh": "Best frozen peas", 
                    "Soooo flavorful!": "I typically" 
                }
            ], 
            "http://www.bbbbbbbbbbbbbbbbbbbbbbbb.com": [
                {
                    "good food": "a very good product", 
                    "Taste is fresh": "Very good frozen peas"
                }
            ]
        }
    ], 
    "66019": [
        {
            "http://www.cccccccccccccccccccccccccccccc.com": [
                {
                    "YUM!": "Tastes really good", 
                    "Very good": "Glad to have tried them"
                }
            ], 
            "http://www.ddddddddddddddddddddddddddddddddd.com": [
                {
                    "Amazing!": "I used orange juice", 
                    "Awesome": "Definitely will try other flavors" 
                }
            ]
        }
    ]
}
</code></pre>

<pre><code>def order_from_chaos(data):
    result = []
    ids = [id_ for id_ in data]
    id_content = [data[id_][0] for id_ in data]
    links_in_id_content = [dictionary.keys() for dictionary in id_content]

    for i in range(len(ids)):
        id_ = ids[i]
        links = links_in_id_content[i]
        descriptions = [id_content[i][key][0] for key in links_in_id_content[i]]
        content = zip(links, descriptions)
        for elem in list(content):
            link = elem[0]
            description_list = elem[1].items()
            for description in description_list:
                formatted_data = id_, link, description[0], description[1]
                result.append(formatted_data)
    return result

data = {
    "60354": [
        {
            "http://www.aaaaaaaaaaaaaaaaaaaa.com": [
                {
                    "Garden fresh": "Best frozen peas",
                    "Soooo flavorful!": "I typically"
                }
            ],
            "http://www.bbbbbbbbbbbbbbbbbbbbbbbb.com": [
                {
                    "good food": "a very good product",
                    "Taste is fresh": "Very good frozen peas"
                }
            ]
        }
    ],
    "66019": [
        {
            "http://www.cccccccccccccccccccccccccccccc.com": [
                {
                    "YUM!": "Tastes really good",
                    "Very good": "Glad to have tried them"
                }
            ],
            "http://www.ddddddddddddddddddddddddddddddddd.com": [
                {
                    "Amazing!": "I used orange juice",
                    "Awesome": "Definitely will try other flavors"
                }
            ]
        }
    ]
}


result = order_from_chaos(data)
[print(res) for res in result]
</code></pre>

<p>will give you</p>

<pre><code>('60354', 'http://www.bbbbbbbbbbbbbbbbbbbbbbbb.com', 'Taste is fresh', 'Very good frozen peas')
('60354', 'http://www.bbbbbbbbbbbbbbbbbbbbbbbb.com', 'good food', 'a very good product')
('60354', 'http://www.aaaaaaaaaaaaaaaaaaaa.com', 'Soooo flavorful!', 'I typically')
('60354', 'http://www.aaaaaaaaaaaaaaaaaaaa.com', 'Garden fresh', 'Best frozen peas')
('66019', 'http://www.cccccccccccccccccccccccccccccc.com', 'Very good', 'Glad to have tried them')
('66019', 'http://www.cccccccccccccccccccccccccccccc.com', 'YUM!', 'Tastes really good')
('66019', 'http://www.ddddddddddddddddddddddddddddddddd.com', 'Awesome', 'Definitely will try other flavors')
('66019', 'http://www.ddddddddddddddddddddddddddddddddd.com', 'Amazing!', 'I used orange juice')

Process finished with exit code 0
</code></pre>

<p>not so cool structure at all. 
but anyway messy way to proceed it</p>

python json pandas dictionary