title: How to change dtype & apply mathematical calculations in np.where?
body: <p>I have dataframe like this</p>
  <pre><code>df = pd.DataFrame()
  df['yy'] = [2012,2011,2010]
  df['mm'] = ['10','','8']
  
      yy      mm
  0   2012    10
  1   2011    
  2   2010    8
  </code></pre>
  <p>I want to multiply values in column 'mm' with 2. However all values on the column are string.
  I tried it with np.where as follows:</p>
  <pre><code>df['X'] = np.where(df['mm']!='',df['mm'].astype(int) * 2,'')
  </code></pre>
  <p>However its not working &amp; giving error as follows:
  ValueError: invalid literal for int() with base 10: ''.<br />
  Its clear from the error that the first filter in the where doesnt work here &amp; its applying df['mm'].astype(int) on all values hence failing for empty string value ''.</p>
  <p>Can anyone please suggest a another way to achieve this ? I don't want to use for loop as y actual df is too big &amp; for loop will take lot of time.
  Thanks in advance.</p>