title: Pandas - Find duplicated entries in one column within rows with equal values in another column
body: <p>Assume a dataframe <code>df</code> like the following:</p>
  <pre><code>  col1 col2
  0    a    A
  1    b    A
  2    c    A
  3    c    B
  4    a    B
  5    b    B
  6    a    C
  7    a    C
  8    c    C
  </code></pre>
  <p>I would like to find those values of <code>col2</code> where there are duplicate entries <code>a</code> in <code>col1</code>. In this example the result should be <code>['C]'</code>, since for <code>df['col2'] == 'C'</code>, <code>col1</code> has two <code>a</code> as entries.</p>
  <p>I tried this approach</p>
  <pre><code>df[(df['col1'] == 'a') &amp; (df['col2'].duplicated())]['col2'].to_list()
  </code></pre>
  <p>but this only works, if the <code>a</code> within a block of rows defined by <code>col2</code> is at the beginning or end of the block, depending on how you define the <code>keep</code> keyword of <code>duplicated()</code>. In this example, it returns <code>['B', 'C']</code>, which is not what I want.</p>