title: How do I add a row to an array using a for loop in python?
body: <p>I have this equation that will produce an array of length 3000:</p>
  <pre><code>dRcs_Stokes=((112*((math.pi)**4))/15)*(((gj)*planck*c*B0*((nu0+i_dnu_Stokes)**4)*gammaSquared)/(((2*I+1)**2)*kb*T))*(i_Xj_Stokes*(math.exp(((-i_Erot)/(kb*T)))))
  </code></pre>
  <p>However, for each iteration inside my for loop, I want to add a new row of length 3000 of newly calculated values to my array. Thus, I should get a 30X3000 array when the for loop is over. How will I do this in python? I keep getting &quot;<strong>only length-1 arrays can be converted to Python scalars</strong>&quot; error. Here are my attemps:</p>
  <pre><code>dnu_Stokes=np.array([])
  Erot= np.array([])
  Xj_Stokes=np.array([])
  dRcs_Stokes=np.array([])
  anti_dnu_Stokes=np.array([])
  anti_Xj_Stokes=np.array([])
  anti_dRcs_Stokes=np.array([])
  
  for i in range(1,30):
      i_dRcs_Stokes[i-1,:]=((112*((math.pi)**4))/15)*(((gj)*planck*c*B0*((nu0+i_dnu_Stokes)**4)*gammaSquared)/(((2*I+1)**2)*kb*T))*(i_Xj_Stokes*(math.exp(((-i_Erot)/(kb*T)))))
  </code></pre>