title: Plotting a pie chart out of a dictionary
body: <p>I have a dictionary:</p>
  <pre><code>{'DATE': 65,
   'ORG': 93,
   'PERSON': 62,
   'GPE': 18,
   'PRODUCT': 18,
   'FAC': 4,
   'CARDINAL': 50,
   'ORDINAL': 15,
   'NORP': 10,
   'MONEY': 3,
   'PERCENT': 2,
   'TIME': 5,
   'LOC': 5,
   'QUANTITY': 2}
  </code></pre>
  <p>All I want is to get this plotted in a pie chart which shows the <em><strong>percentage distribution</strong></em> of these items. How can i plot this????</p>
  <p>I have tried the solution here: <a href="https://stackoverflow.com/questions/40874023/trying-to-create-a-pie-and-bar-chart-from-the-data-below">Trying to create a pie and bar chart from the data below</a></p>
  <p>So i used the code which was published there as a solution:</p>
  <pre><code>amount_of_TP_ner_tags # this is the dictionary I want to plot. see above
  
  # dont use values inside a list as column values for a dataframe
  browser2 = {}
  [browser2.update({key : val[0]}) for key, val in amount_of_TP_ner_tags.items()]
  
  x = pd.Series(browser2)
  y = pd.Series.sort_values(x)
  z = pd.DataFrame(y)
  fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(8,4))
  # you need to specify which column of the dataframe you want to plot (here 0)
  z.plot(y=0, kind = 'pie', ax = axes[0])
  z.plot(kind = 'bar', ax = axes[1])
  axes[0].set_aspect(&quot;equal&quot;) # make aspect equal (such that circle is not eliptic)
  #place the legend at a decent position
  axes[0].legend(loc=1, bbox_to_anchor= (1,0.2), fontsize=11)
  plt.tight_layout()
  plt.show()
  </code></pre>
  <p>But I receive an error message:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-258-7ca72d2d0ca4&gt; in &lt;module&gt;
        1 # dont use values inside a list as column values for a dataframe
        2 browser2 = {}
  ----&gt; 3 [browser2.update({key : val[0]}) for key, val in amount_of_TP_ner_tags.items()]
        4 
        5 x = pd.Series(browser2)
  
  &lt;ipython-input-258-7ca72d2d0ca4&gt; in &lt;listcomp&gt;(.0)
        1 # dont use values inside a list as column values for a dataframe
        2 browser2 = {}
  ----&gt; 3 [browser2.update({key : val[0]}) for key, val in amount_of_TP_ner_tags.items()]
        4 
        5 x = pd.Series(browser2)
  
  TypeError: 'int' object is not subscriptable
  </code></pre>
  <p>So how can I plot this?</p>