title: Filter df so values are equal across groups - pandas
body: <p>I've got a pandas <code>df</code> that contains values at various time points. I perform a groupby of these time points and values. I'm hoping the filter the output so both groups contain values at each time point. If either group does not contain a value at that time point I want to drop that row.</p>
  <p>Using the <code>df</code> below, there is values for <code>Group A</code> and <code>Group B</code> at various time points. However, time point <code>3,4,6</code> only contain one item from either <code>Group A</code> or <code>Group B</code>. When there isn't at least two items per group, I want to drop these rows altogether.</p>
  <p>The ordering matters and not the total amount. So if there are missing items for either <code>Group</code> at a specific time point, I want to drop these rows.</p>
  <p>Note: the df only contains a max of one value per group at each time point. But my actual data could contain numerous. The main concern is dropping rows where at least one group is absent.</p>
  <pre><code>df1 = pd.DataFrame({   
          'Time' : [1,1,1,2,2,3,4,5,5,6],   
          'Group' : ['A','B','B','A','B','A','B','A','B','B'],                    
          'Val_A' : [6,7,4,5,4,4,9,6,7,8],  
          'Val_B' : [1,2,2,3,2,1,2,1,4,9],         
          'Val_C' : [1,2,2,3,4,5,7,8,9,7],                      
      }) 
  
  
  Group_A = df1.loc[df1['Group'] == 'A']
  Group_B = df1.loc[df1['Group'] == 'B']
  
  Group_A = list(Group_A.groupby(['Time'])['Val_A'].apply(list))
  Group_B = list(Group_B.groupby(['Time'])['Val_B'].apply(list))
  
  print(df1)
  print(Group_A)
  print(Group_B) 
  
     Time Group  Val_A  Val_B  Val_C
  0     1     A      6      1      1
  1     1     B      7      2      2
  2     1     B      4      2      2
  3     2     A      5      3      3
  4     2     B      4      2      4
  5     3     A      4      1      5
  6     4     B      9      2      7
  7     5     A      6      1      8
  8     5     B      7      4      9
  9     6     B      8      9      7
  [[6], [5], [4], [6]]
  [[2, 2], [2], [2], [4], [9]]
  </code></pre>
  <p>I can't use <code>dropna</code> or <code>drop_duplicates</code>. Furthermore, data may contain items for <code>Group B</code> and not <code>Group A</code>. So I'm hoping to find a function that can handle both instances.</p>
  <p>Intended Output:</p>
  <pre><code>  Time Group  Val_A  Val_B  Val_C
  0     1     A      6      1      1
  1     1     B      7      2      2
  2     1     B      4      2      2
  3     2     A      5      3      3
  4     2     B      4      2      4
  7     5     A      6      1      8
  8     5     B      7      4      9
  [[6], [5], [6]]
  [[2, 2], [2], [4]]
  </code></pre>