title: Python Pie chart from CSV data
body: <p>I have a .csv file that contains 3 columns that I must read into Python and convert to a pie plot.</p>
  
  <p>I've managed to produce a pie chart plot if I create lists manually of the data, but I'm stuck on reading the data from my .csv into python.</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import csv
  
  outfile = open("vote_results.csv","r")
  
  file=csv.reader(outfile)
  #skip the headers
  next(file, None)
  
  Party = []
  Seats = []
  Votes = []
  
  for row in file:
      Party = row[0]
      Seats = row[1]
      Votes = row[2]
  
  plt.pie(Votes, labels=Party)
  plt.show()
  </code></pre>
  
  <p>I keep getting:</p>
  
  <pre><code>TypeError: "Object of type 'numpy.float64' has no len()"
  </code></pre>
  
  <p>which I thought was due to having headers and so tried </p>
  
  <pre><code>next(file, None)
  </code></pre>
  
  <p>to remove them but still get the error.</p>
  
  <p>The CSV file looks like</p>
  
  <pre><code>Party      Seats       Votes
  
  Party1      50           1000
  
  Party2      41           680
  
  Party3      32           481
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/sjam7.png" rel="nofollow noreferrer">screenshot of console output</a></p>
  
  <p><a href="https://i.stack.imgur.com/ztH98.png" rel="nofollow noreferrer">screenshot of .csv file</a></p>