title: Change multiple columns in a DataFrame
body: <p>I am a beginner in Python and made my first venture into Pandas today. What I want to do is to convert several columns from string to float. Here's a quick example:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  
  def convert(str):
      try:
          return float(str.replace(',', ''))
      except:
          return None
  
  df = pd.DataFrame([
      ['A', '1,234', '456,789'],
      ['B', '1'    , '---'    ]
  ], columns=['Company Name', 'X', 'Y'])
  </code></pre>
  
  <p>I want to convert <code>X</code> and <code>Y</code> to float. The reality has more columns and I don't always know the column names for <code>X</code> and <code>Y</code> so I must use integer indexing.</p>
  
  <p>This works:</p>
  
  <pre><code>df.iloc[:, 1] = df.iloc[:, 1].apply(convert)
  df.iloc[:, 2] = df.iloc[:, 2].apply(convert)
  </code></pre>
  
  <p>This doesn't:</p>
  
  <pre><code>df.iloc[:, 1:2] = df.iloc[:, 1:2].apply(convert)
  # Error: could not broadcast input array from shape (2) into shape (2,1)
  </code></pre>
  
  <p>Is there anyway to apply the <code>convert</code> function on multiple columns at once?</p>