title: Python: Splitting a string at any uppercase letter (as part of a rename for a column name)
body: <p>I would like to rename columns in a Pandas dataframe using <em>rename</em> function and therefore I would like to split the name (string) at an uppercase letter within the string.
  So for example my column names are something like 'FooBar' or 'SpamEggs' and one column is called 'Monty-Python'. My goal are column names like 'foo_bar' 'spam_eggs' and 'monty_python'.</p>
  
  <p>I know that </p>
  
  <pre><code>'-'.join(re.findall('[A-Z][a-z]*', 'FooBar'))
  </code></pre>
  
  <p>will give me 
      <code>Foo-Bar</code></p>
  
  <p>But this cannot be included in my <em>rename</em> function:</p>
  
  <pre><code>df.rename(columns=lambda x: x.strip().lower().replace("-", "_"), inplace=True)
  </code></pre>
  
  <p>(should go between <em>strip</em> and <em>lower</em> but gives back a Syntax Error).</p>
  
  <p>Can anyone help me to include the snippet to <em>rename</em> or help me find another solution than <em>findall</em>?</p>