title: Adding list with different length as a new column to a dataframe
body: <p>I am willing to add or insert the list values in the dataframe. The dataframe len is <code>49</code>, whereas the length of list id <code>47</code>. I am getting the following error while implementing the code.   </p>
  
  <pre><code>print("Lenght of dataframe: ",datasetTest.open.count())
  print("Lenght of array: ",len(test_pred_list))
  datasetTest['predict_close'] = test_pred_list
  </code></pre>
  
  <p>The error is:  </p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-105-68114a4e9a82&gt; in &lt;module&gt;()
        5 # datasetTest = datasetTest.dropna()
        6 # print(datasetTest.count())
  ----&gt; 7 datasetTest['predict_close'] = test_pred_list
        8 # test_shifted['color_predicted'] = test_shifted.apply(determinePredictedcolor, axis=1)
        9 # test_shifted['color_original'] =
  
  c:\python35\lib\site-packages\pandas\core\frame.py in __setitem__(self, key, value)
     2517         else:
     2518             # set column
  -&gt; 2519             self._set_item(key, value)
     2520 
     2521     def _setitem_slice(self, key, value):
  
  c:\python35\lib\site-packages\pandas\core\frame.py in _set_item(self, key, value)
     2583 
     2584         self._ensure_valid_index(value)
  -&gt; 2585         value = self._sanitize_column(key, value)
     2586         NDFrame._set_item(self, key, value)
     2587 
  
  c:\python35\lib\site-packages\pandas\core\frame.py in _sanitize_column(self, key, value, broadcast)
     2758 
     2759             # turn me into an ndarray
  -&gt; 2760             value = _sanitize_index(value, self.index, copy=False)
     2761             if not isinstance(value, (np.ndarray, Index)):
     2762                 if isinstance(value, list) and len(value) &gt; 0:
  
  c:\python35\lib\site-packages\pandas\core\series.py in _sanitize_index(data, index, copy)
     3119 
     3120     if len(data) != len(index):
  -&gt; 3121         raise ValueError('Length of values does not match length of ' 'index')
     3122 
     3123     if isinstance(data, PeriodIndex):
  
  ValueError: Length of values does not match length of index
  </code></pre>
  
  <p>How I can get rid of this error. Please help me.</p>