title: TypeError: can't multiply sequence by non-int of type 'numpy.float64' - multiply column by value
body: <p>I am having problems creating a new column in my dataframe by multiplying an existing column by a value - I have looked over similar questions but have been unable to understand how to fix my code below:</p>
  
  <pre><code>list = []
  
  i = 1
  for col in df.columns[1:19]:
  
      #calculations
      x = df[[df.columns[i], df.columns[i+1], df.columns[i+2]]].values
      Q = np.cov(x.T)
  
      eval, evec = np.linalg.eig(Q)
  
      w = np.array([2*(evec[0,2]/evec[1,2]),2*(evec[1,2]/evec[1,2]),2*(evec[2,2]/evec[1,2])])
  
      #create new columns in dataframe with applied weights
      df['w1_PCA'] = df.columns[i] * w[0]
      df['b_PCA'] = df.columns[i+1] * w[1]
      df['w2_PCA'] = df.columns[i+2] * w[2]
  
      i = i + 1
  
  print(x)
  </code></pre>
  
  <p>Receiving the error as follows:</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-26-d7d86010b8f8&gt; in &lt;module&gt;
   19 
   20     #create new columns in dataframe for back-applied PCA weights
  ---&gt; 21     df['w1_PCA'] = df.columns[i] * w[0]
   22     df['b_PCA'] = df.columns[i+1] * w[1]
   23     df['w2_PCA'] = df.columns[i+2] * w[2]
  
  TypeError: can't multiply sequence by non-int of type 'numpy.float64'
  </code></pre>
  
  <p>Could someone please advise me as to where I am going wrong with this?</p>
  
  <p>Any help is much appreciated!</p>