title: Adding an array to pandas dataframe
body: <p>I have a dataframe, and I want to create a new column and add arrays to this each row of this new column. I know to do this I have to change the datatype of the column to 'object' I tried the following but it doesn;t work,  </p>
  
  <pre><code>import pandas
  import numpy as np
  
  df = pandas.DataFrame({'a':[1,2,3,4]})
  df['b'] = np.nan
  df['b'] = df['b'].astype(object)
  df.loc[0,'b'] = [[1,2,4,5]]
  </code></pre>
  
  <p>The error is</p>
  
  <pre><code>ValueError: Must have equal len keys and value when setting with an ndarray
  </code></pre>
  
  <p>However, it works if I convert the datatype of the whole dataframe into 'object':</p>
  
  <pre><code>df = pandas.DataFrame({'a':[1,2,3,4]})
  df['b'] = np.nan
  df = df.astype(object)
  df.loc[0,'b'] = [[1,2,4,5]] 
  </code></pre>
  
  <p>So my question is: why do I have to change the datatype of whole DataFrame?</p>