title: Remove Dataframes from List of Dataframes based on condition
body: <p>I have a script that creates a list of dataframes to concatenate. Before concatenation, I am checking a certain column in each dataframe for the presence of a '1' binary flag. If there is not a one, I want to delete the dataframe from the list of dataframes. I am having trouble because I am not sure how to properly index the list to remove the dataframe. I recreated the problem with this code.</p>
  
  <pre><code>data = {'Name':['Tom', 'Tom', 'Tom', 'Tom'], 'Age':[20, 21, 19, 18]} 
  data2 = {'Name':['Tom', 'nick', 'krish', 'jack'], 'Age':[20, 21, 19, 18]} 
  
  # Create DataFrame 
  df = pd.DataFrame(data)
  df2 = pd.DataFrame(data2)
  df3 = pd.DataFrame(data)
  df4 = pd.DataFrame(data2)
  
  dflist = [df, df2, df3, df4]
  
  
  for frame in dflist:
          vals = frame["Name"].values
          if 'krish' not in vals:
               dflist.remove(frame)
  </code></pre>
  
  <p>But</p>
  
  <pre><code>ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  
  <p>I also tried enumerating the list and deleting based off dflist[i], but that changes the index if something is deleted so subsequently the wrong frames will be removed. </p>
  
  <p>What is the proper way to remove dataframes from a list of df's based on condition? Thank you!</p>