title: Dropping a group of columns based on a condition fulfilled by a column in Pandas
body: <p>I have a dataframe whereby the column names are tuples. Below is a sample data for my dataframe:</p>
  <pre><code>data = {&quot;('7086', 'Open')&quot;: {5: 0.0700000002980232, 6: 0.0649999976158142, 7: 0.0750000029802322, 8: 0.0649999976158142, 9: 0.0700000002980232},
   &quot;('7086', 'High')&quot;: {5: 0.0700000002980232, 6: 0.0750000029802322, 7: 0.0750000029802322, 8: 0.0750000029802322, 9: 0.0700000002980232},
   &quot;('7086', 'Low')&quot;: {5: 0.0700000002980232, 6: 0.0649999976158142, 7: 0.0750000029802322, 8: 0.0649999976158142, 9: 0.0700000002980232},
   &quot;('7086', 'Close')&quot;: {5: 0.0700000002980232, 6: 0.0750000029802322, 7: 0.0750000029802322, 8: 0.0750000029802322, 9: 0.0700000002980232},
   &quot;('7086', 'Adj Close')&quot;: {5: 0.0700000002980232, 6: 0.0750000029802322, 7: 0.0750000029802322, 8: 0.0750000029802322, 9: 0.0700000002980232},
   &quot;('7086', 'Volume')&quot;: {5: 0, 6: 3200, 7: 0, 8: 200800, 9: 260000},
   &quot;('03028', 'Open')&quot;: {5: 0.3600000143051147, 6: 0.3600000143051147, 7: 0.3600000143051147, 8: 0.3600000143051147, 9: 0.3600000143051147},
   &quot;('03028', 'High')&quot;: {5: 0.3600000143051147, 6: 0.3600000143051147, 7: 0.3600000143051147, 8: 0.3600000143051147, 9: 0.3600000143051147},
   &quot;('03028', 'Low')&quot;: {5: 0.3600000143051147, 6: 0.3600000143051147, 7: 0.3600000143051147, 8: 0.3600000143051147, 9: 0.3600000143051147},
   &quot;('03028', 'Close')&quot;: {5: 0.3600000143051147, 6: 0.3600000143051147, 7: 0.3600000143051147, 8: 0.3600000143051147, 9: 0.3600000143051147},
   &quot;('03028', 'Adj Close')&quot;: {5: 0.3509772419929504, 6: 0.3509772419929504, 7: 0.3509772419929504, 8: 0.3509772419929504, 9: 0.3509772419929504},
   &quot;('03028', 'Volume')&quot;: {5: 15500.0, 6: 0.0, 7: 0.0, 8: 0.0, 9: 0.0}}
  </code></pre>
  <pre><code>df = pd.DataFrame(data)
  
     ('7086', 'Open')  ...  ('03028', 'Volume')
  5             0.070  ...              15500.0
  6             0.065  ...                  0.0
  7             0.075  ...                  0.0
  8             0.065  ...                  0.0
  9             0.070  ...                  0.0
  
  [5 rows x 12 columns]
  </code></pre>
  <p>Now, what I hope to perform is to remove the group of columns with the same number code when one of the columns in the number code has only 1 unique number:</p>
  <pre><code>df.nunique()
  
  ('7086', 'Open')          3
  ('7086', 'High')          2
  ('7086', 'Low')           3
  ('7086', 'Close')         2
  ('7086', 'Adj Close')     2
  ('7086', 'Volume')        4
  ('03028', 'Open')         1
  ('03028', 'High')         1
  ('03028', 'Low')          1
  ('03028', 'Close')        1
  ('03028', 'Adj Close')    1
  ('03028', 'Volume')       2
  dtype: int64
  </code></pre>
  <p>As above, we can see in the number code <code>03028</code>, that 5 out of 6 columns have only 1 unique value. Therefore, I wish to remove all the 6 columns with the same number code based on this fact. Is there any idea I can do that? I was thinking of grouping it together and dropping it. But I'm not sure how to deal with the tuples. Thanks in advance.</p>
  <p>My expected output will be:</p>
  <pre><code>   ('7086', 'Open')  ...  ('7086', 'Volume')
  5             0.070  ...                   0
  6             0.065  ...                3200
  7             0.075  ...                   0
  8             0.065  ...              200800
  9             0.070  ...              260000
  
  [5 rows x 6 columns]
  </code></pre>