title: Matplotlib Pyplot Pie Chart From CSV File
body: <p>I've got a CSV file with 1 column with values 0 or 1, I'm trying to plot the number of values as a pie chart. </p>
  
  <p>I have tried:</p>
  
  <pre><code>fileName = sys.argv[1]
  col1 = sys.argv[2]
  
  file = pd.read_csv(fileName)
  data = np.array(file)[:,col1]
  
  labels = 'True', 'False'
  sizes = data
  colors = ['red', 'blue']
  
  plt.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', shadow=True, startangle=140)
  plt.axis('equal')
  plt.show()
  </code></pre>
  
  <p>But it errors. How can I display a 2 slice pie chart from the CSV column? The values are out of order. I did something similar with a bar chart and it automatically just figured it all out. </p>
  
  <p>Traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "pie.py", line 18, in &lt;module&gt;
  plt.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', shadow=True, startangle=140)
    File "~\matplotlib\pyplot.py", line 3137, in pie
  frame=frame, data=data)
    File "~\matplotlib\__init__.py", line 1811, in inner
  return func(ax, *args, **kwargs)
    File "~\matplotlib\axes\_axes.py", line 2559, in pie
  raise ValueError("'label' must be of length 'x'")
  ValueError: 'label' must be of length 'x'
  </code></pre>