title: How to read a csv file and plot confusion matrix in python
body: <p>I have a CSV file with 2 columns as</p>
  
  <pre><code>actual,predicted
  1,0
  1,0
  1,1
  0,1
  .,.
  .,.
  </code></pre>
  
  <p>How do I read this file and plot a confusion matrix in Python?
  I tried the following code from a program.</p>
  
  <pre><code>import pandas as pd
  from sklearn.metrics import confusion_matrix
  import numpy
  
  CSVFILE='./mappings.csv'
  test_df=pd.read_csv[CSVFILE]
  
  actualValue=test_df['actual']
  predictedValue=test_df['predicted']
  
  actualValue=actualValue.values
  predictedValue=predictedValue.values
  
  cmt=confusion_matrix(actualValue,predictedValue)
  print cmt
  </code></pre>
  
  <p>but it gives me this error.</p>
  
  <pre><code>Traceback (most recent call last):
    File "confusionMatrixCSV.py", line 7, in &lt;module&gt;
      test_df=pd.read_csv[CSVFILE]
  TypeError: 'function' object has no attribute '__getitem__'
  </code></pre>