title: Adding np arrays to existing pandas dataframe
body: <p>I've been trying to figure out a problem I came across for a while now, but somehow I cannot find the solution.</p>
  
  <p>I've created a pandas dataframe which is already filled with values, let's say dimension (4,3)</p>
  
  <pre><code>df=
    A    B    C
  0 valX valX valX
  1 valY valY valY
  2 valZ valZ valZ
  3 valW valW valW
  </code></pre>
  
  <p>What I want to do right now is append ten additional columns, each containing a numpy array filled with 38 zero's.</p>
  
  <p>My solution seems to be working when I first cast my array to a string and then add it to the original df. </p>
  
  <p>However, Pandas doesn't accept a plain numpy array.
  I need the value of the column to be a numpy array, as I will later do some sklearn computations on them. </p>
  
  <p>Later in my code, I substitute certain columns with a one-hot encoding of certain characters. The remaining columns act as a zero-padding.</p>
  
  <p>Example of my code (which works for adding 10 columns): </p>
  
  <pre><code>#create empty array
  x = np.zeros(38)
  for i in range(0, 10):
      col_name = "char_" + str(i)
  
      df[col_name] = str(x)
  </code></pre>
  
  <p>The problem here is that I need to cast x to a string. If I keep it as a numpy array, it throws me this error:</p>
  
  <pre><code>ValueError: Length of values does not match length of index
  </code></pre>