title: Filter a Pandas DataFrame Through a Dictionary
body: <p>I have a pandas dataframe with a number of columns. (Please see the table below.) Each column belongs to a group categorization G1-G4. This mapping of groups is in a data dictionary. If I want to filter the columns in the pandas dataframe based on the grouping data dictionary, for example to filter out all G3 and produce the resulting table below, what is the most efficient way of doing this?</p>
  
  <p><a href="https://i.stack.imgur.com/rUpX3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rUpX3.png" alt="enter image description here"></a></p>
  
  <p>Thank you.</p>