title: Filter data frame based on index value in Python
body: <p>I have a data frame <code>df</code> with thousands of rows, and a sample is this:</p>
  
  <pre><code>    Index           A   B   C   D   E   F               
      EX-A.1.A.B-1A  18   7   2   2   9   8       
      EX-A.1.A.B-1C   0   0   0   0   0   0       
      EX-A.1.A.B-4A   6   4   8   6   1   1   
      EX-A.1.A.B-4C   0   0   0   0   0   0   
      EX-A.1.A.B-4F   0   0   0   0   0   0
  </code></pre>
  
  <p>I also have a list <code>my_list = ["EX-A.1.A.B-1A","EX-A.1.A.B-4A","EX-A.1.A.B-4F"]</code></p>
  
  <p>and I want to filter the <code>df</code> based on this list, therefore I want to keep the rows for which the index value is in the list <code>my_list</code>.</p>
  
  <p>I tried this in order to create a new filtered df: <code>Filter_df = df[df.index in my_list]</code> and I get this error:</p>
  
  <pre><code>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().
  </code></pre>
  
  <p>Any ideas on how I could do this? Thanks</p>