title: Resolving TypeError: 'file' object has no attribute '__getitem__'
body: <p>I'm trying to create a file that includes the names only on file 1 and that are not on file 1. I get an error running the following code:</p>
  
  <pre><code>import pandas
  import csv
  f = pandas.read_csv('hillelclass2019.csv')
  g = pandas.read_csv('shabsignup.csv')
  for i in range(193): #length of data1
      x = str(f['First Name'][i]) + " " + str(f['Last Name'][i]) #first name + last name
      a = 0 #initial
      for j in range(25): #length of data2
          if g['Name'][j] == x: #if name == name on other sheet, then a == 1
              a == 1
      if a == 0: #if names are not equal 
          with open('noshab.csv', 'a') as f: #write name to file
              wtr = csv.writer(f, delimiter= ',')
              wtr.writerow( [x,i])
  </code></pre>
  
  <p>the error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  /var/folders/kz/351q8p011qjc2x4k9srypcqc0000gn/T/tmpf4VgQX.py in &lt;module&gt;()
        5 g = pandas.read_csv('shabsignup.csv')
        6 for i in range(193): #length of data1
  ----&gt; 7     x = str(f['First Name'][i]) + " " + str(f['Last Name'][i]) #first name + last name
        8     a = 0 #initial
        9     for j in range(25): #length of data2
  
  TypeError: 'file' object has no attribute '__getitem__' 
  </code></pre>
  
  <p>The code works when I set i in range(1) and only run 1 iteration, but does not work for multiple lines.</p>