title: Converting a dict containing multiple nestet dicts into a .csv
body: <p>I have a dict in Python containing multiple nestet dicts and I want to write them into a csv file.</p>
  <p>The dict looks something like this:</p>
  <pre><code>dict = {'case1':{'variant1':{'Name':['1','2','3'],'Values':[1,2,3],'Unit':['one','two','three']}},
                   'variant2':{'Name':['1','2','3'],'Values':[1,2,3],'Unit':['one','two','three']},
          'case2':{'variant1':{'Name':['1','2','3'],'Values':[1,2,3],'Unit':['one','two','three']}},
                   'variant2':{'Name':['1','2','3'],'Values':[1,2,3],'Unit':['one','two','three']}}
  </code></pre>
  <p>So multiple cases with different variants and each variant conatins three lists of corresponding names, values and units.
  As stated before I want to convert this dict into a csv file, ideally in a way where the different cases an variant are easilly distinguishable. Since the csv is going to be used primarilly in Excel I'm going to give an example of how I imagined it could look in Excel. Ideal would be something like this:
  <a href="https://i.stack.imgur.com/gRxvT.png" rel="nofollow noreferrer">test_dict2csv</a></p>
  <p>I know how to write a single variant (so one set of names, values and units) into a csv the code for which looks like this:</p>
  <pre><code>keys = sorted(dict['case1']['variant1'].keys())
  with open(&quot;test_output.csv&quot;, &quot;w&quot;) as outfile:
     writer = csv.writer(outfile,delimiter=';')
     writer.writerow(keys)
     writer.writerows(zip(*[dict['case1']['variant1'][key] for key in keys]))
  </code></pre>
  <p>But I don't know how to add the next variants and cases in the same row some columns down.</p>
  <p>If anyone has an idea I would be very grateful :)</p>