title: rename multiple columns in pandas by keyword
body: <p>I need to rename columns in pandas so that several different column names associated to a pre-defined keyword have their titles replaced by that key word.</p>
  
  <p>I would like that a list of several different potential column names are associated to one key word, which I can then use to later group information. It is not like this problem in <a href="https://stackoverflow.com/questions/11346283/renaming-columns-in-pandas">Renaming columns in pandas</a> as this does not address the use of multiple column names that can be associated to one keyword.</p>
  
  <p>For instance: cats, dogs, birds, fish -> are replaced with the title "animals"</p>
  
  <p>I was looking at the rename function <a href="https://stackoverflow.com/questions/45468630/change-column-names-in-pandas-dataframe-from-a-list">HERE</a>  and <a href="https://stackoverflow.com/questions/36531675/rename-columns-in-pandas-based-on-dictionary">HERE</a> , however, it does not seem to take into account the possibility to have multiple columns be associated to a key word to rename.</p>
  
  <p>Is this posisble to do within pandas?</p>
  
  <p>My (not-working) attempt so far is as follows:</p>
  
  <pre><code>newNames = {
      'animals':['cats','dogs','fish'],
      'colors':['red','blue','green']
  }
  </code></pre>
  
  <p><strong>sample df:</strong></p>
  
  <pre><code>cats    dogs    fish    red
  1   2   3   2
  2   3   5   4
  3   4   3   4
  
  df.rename(index=str,columns=newNames,inplace=True)
  </code></pre>
  
  <p><strong>desired result</strong>:</p>
  
  <pre><code>animals     animals     animals     colors
  1   2   3   2
  2   3   5   4
  3   4   3   4
  </code></pre>