title: Creating New Dataframes from Conditions
body: <p>I'm attempting to create 2 separate data frames from the code below:</p>
  <pre><code>import pandas as pd
  
  sport = ('basketball','volleyball','football')
  science = ('biology','chemistry','physics')
  
  sportdf = pd.DataFrame(columns = ['Name','Interest'])
  sciencedf = pd.DataFrame(columns = ['Name','Interest'])
  
  data = [['tom', 'volleyball'], ['nick', 'chemistry'], ['juli', 'physics']] 
    
  df = pd.DataFrame(data, columns = ['Name', 'Interest'])
  
  s = []
  q = []
  for i in range(len(df)):
      if df.loc[i,&quot;Interest&quot;] in sport:
          s.append(df.loc[i,&quot;Name&quot;])
          s.append(df.loc[i,&quot;Interest&quot;])
          df_length = len(s)
          sportdf.loc[df_length] = s
          print(df)
      else:
          q.append(df.loc[i,&quot;Name&quot;])
          q.append(df.loc[i,&quot;Interest&quot;])
          df_length = len(q)
          #sciencedf.loc[df_length] = q 
  </code></pre>
  <p>The expected output is the sportdf data frame will have one row which is 'tom' and 'volleyball' and the sciencedf to be 'nick' 'chemistry' and 'juli' 'physics'.</p>
  <p>However in the code above I am getting the sportdf created successfully but the sciencedf is not created because the list q is ['nick','chemistry','juli','physics]. I can split this in other ways then add but I feel like I'm making this 100x harder than it actually is. To summarize:</p>
  <pre><code>for every row in df:
  if the cell of the 'Interest' column is in the sport tuple:
  add the row to the sportdf
  if it is not (elif):
  add the row to the sciencedf
  </code></pre>