title: Python:How to assign a list or an array to an array element?
body: <p>My code requires me to replace elements of an array of dimension 3x3 with a list or array of a certain dimension. How can I achieve that? When I write my code, it throws an error stating that:</p>
  
  <pre><code>ValueError: setting an array element with a sequence.
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>import numpy as np
  Y=np.array([1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,4])
  c_g=np.array([[[1,2],[2,3]],[[4,5],[1,6]]])
  xx=[1,2,3]
  var=2
  theta_g=np.zeros((c_g.shape[0],c_g.shape[1]))
  for i in range(c_g.shape[0]):
      for j in range(c_g.shape[1]):
           theta_g[i][j]=Y[var:var+len(c_g[i][j])**len(xx)]
           #here Y is some one dimensional array or list which I want to //
           #assign to each element of theta_g
           var=var+len(c_g[i][j])**len(xx)
  print theta_g
  </code></pre>
  
  <p>In the code above I want to manipulate <code>theta_g</code>. In fact, I want to assign an array to each element of theta_g. How can I accomplish that?
  Desired Output: <code>theta_g</code> which is a matrix of dimension equal to that of <code>c_g</code>.</p>