title: Applying numeric format to a column in a pandas data frame that contains spaces as values
body: <p>I am facing a problem while applying a numeric format to columns in a data frame, As the columns contain non-numeric value (' ' as a value). I have tried to convert the columns into numeric and apply format to those columns and facing some errors.</p>
  
  <p>So, is there a way of converting columns to numeric and apply format ignoring non-numeric values( only ' ' as value in this case)</p>
  
  <p>Here is my piece of code i tried and facing errors. Any suggestions </p>
  
  <p><code><pre>
  <code>pd.to_numeric(df_both['col1','col2'],errors='ignore')</code>
  <code>df_both[['col1','col2']] = df_both[['col1','col2']].replace({'nan':''},regex=True)</code>
  <code>df_both['col1'] = df_both.apply(lambda x: "{:,}".format(x['col1']),axis=1)</code>
  <code>df_both['col2'] = df_both.apply(lambda x: "{:,}".format(x['col2']),axis=1)</code>
  </code></pre></p>