title: Python - Pandas '.isin' on a list
body: <p>I'm using Python 2.7 on Mac OSX Lion and Pandas 0.11.0 with the IPython shell.</p>
  
  <p>I have a brief issue, using the data selection method <code>.isin</code>.</p>
  
  <p>The issue is that I would like to use <code>.isin</code> on a list of items, so:</p>
  
  <pre><code>data = df[df[header[0]].isin(list)]
  </code></pre>
  
  <p>I get the following error when I do this: <code>KeyError: u'no item named '</code></p>
  
  <p>I generate the initial list by calling a previously developed function.  I tried using <code>eval</code> on the list, which seems to solve an issue that comes about when using <code>raw_input</code> and iterating over items within it - kinda trying to work out some of the issues I've been having when transitioning to <code>IPython</code> and <code>Python 2.7</code> (originally used <code>Python 3.3</code>).</p>
  
  <p>I also tried iterating over the list, by first doing:</p>
  
  <pre><code>data = df[df[header[0]].isin(list[0])]
  </code></pre>
  
  <p>But that also returns: <code>KeyError: u'no item named '</code></p>
  
  <p>UPDATE:
  Here is the header:</p>
  
  <pre><code> Unnamed: 0         9752  non-null values
   zipcode            9752  non-null values
   xcoord             9752  non-null values
   ycoord             9752  non-null values
   age_age5064        9752  non-null values
   age_age6574        9752  non-null values
   age_age75plus      9752  non-null values
   sex_female         9752  non-null values
   sex_male           9752  non-null values
   stage_early        9752  non-null values
   stage_late         9752  non-null values
   death_death        9752  non-null values
   death_not_death    9752  non-null values
   access             9752  non-null values
   dtypes: float64(2), int64(12)
  </code></pre>
  
  <p>Also, I have a function I use to get the header, which makes things easier for me, the output looks like this:</p>
  
  <pre><code>['',
    'zipcode',
    'xcoord',
    'ycoord',
   'age_age5064',
   'age_age6574',
   'age_age75plus',
   'sex_female',
   'sex_male',
   'stage_early',
   'stage_late',
   'death_death',
   'death_not_death',
   'access']
  </code></pre>
  
  <p>Which, actually, now that I think about it, may be what is causing the problem- although <code>eval</code> still would not fix it.</p>
  
  <p>UPDATE 2:</p>
  
  <p>So, initially, as you can see in the above <code>.isin</code>, I was using <code>header[0]</code>, which was not right.  I tried again using <code>header[1]</code>, which is appropriate.  I get the following error:</p>
  
  <pre><code> TypeError: 'int' object is not iterable
  </code></pre>
  
  <p>I also tried the regular list again and got this error:</p>
  
  <pre><code>TypeError: int() argument must be a string or a number, not 'list'
  </code></pre>
  
  <p>Which, I guess, speaks more definitively to the issue....</p>