Delete groups of rows based on condition
<p>I have the following pandas dataframe:</p>

<pre><code>df =

A          B       C
111-ABC    123    EEE
111-ABC    222    EEE
111-ABC    444    XXX
222-CCC    222    YYY
222-CCC    333    67T
333-DDD    123    TTT
333-DDD    123    BTB
333-DDD    444    XXX
333-DDD    555    AAA
</code></pre>

<p>I want to delete all groups of rows (grouped by <code>A</code>) that do not contain <code>123</code> in the column <code>B</code>.</p>

<p>The expected result is this one (the group of rows <code>222-CCC</code> is deleted):</p>

<pre><code>result =

A          B       C
111-ABC    123    EEE
111-ABC    222    EEE
111-ABC    444    XXX
333-DDD    123    TTT
333-DDD    123    BTB
333-DDD    444    AAA
</code></pre>

<p>How to do it? I assume that first of all I should use <code>groupby</code>, but how to filter out the groups of rows, not just particular rows?</p>

<pre><code>result = df.groupby("A").... ??
</code></pre>