title: Add column of empty lists to DataFrame
body: <p>Similar to this question <a href="https://stackoverflow.com/questions/16327055/how-to-add-an-empty-column-to-a-dataframe">How to add an empty column to a dataframe?</a>, I am interested in knowing the best way to add a column of empty lists to a DataFrame.</p>
  
  <p>What I am trying to do is basically initialize a column and as I iterate over the rows to process some of them, then add a filled list in this new column to replace the initialized value.</p>
  
  <p>For example, if below is my initial DataFrame:</p>
  
  <pre><code>df = pd.DataFrame(d = {'a': [1,2,3], 'b': [5,6,7]}) # Sample DataFrame
  
  &gt;&gt;&gt; df
     a  b
  0  1  5
  1  2  6
  2  3  7
  </code></pre>
  
  <p>Then I want to ultimately end up with something like this, where each row has been processed separately (sample results shown):</p>
  
  <pre><code>&gt;&gt;&gt; df
     a  b          c
  0  1  5     [5, 6]
  1  2  6     [9, 0]
  2  3  7  [1, 2, 3]
  </code></pre>
  
  <p>Of course, if I try to initialize like <code>df['e'] = []</code> as I would with any other constant, it thinks I am trying to add a sequence of items with length 0, and hence fails.</p>
  
  <p>If I try initializing a new column as <code>None</code> or <code>NaN</code>, I run in to the following issues when trying to assign a list to a location.</p>
  
  <pre><code>df['d'] = None
  
  &gt;&gt;&gt; df
     a  b     d
  0  1  5  None
  1  2  6  None
  2  3  7  None
  </code></pre>
  
  <p>Issue 1 (it would be perfect if I can get this approach to work! Maybe something trivial I am missing):</p>
  
  <pre><code>&gt;&gt;&gt; df.loc[0,'d'] = [1,3]
  
  ...
  ValueError: Must have equal len keys and value when setting with an iterable
  </code></pre>
  
  <p>Issue 2 (this one works, but not without a warning because it is not guaranteed to work as intended):</p>
  
  <pre><code>&gt;&gt;&gt; df['d'][0] = [1,3]
  
  C:\Python27\Scripts\ipython:1: SettingWithCopyWarning:
  A value is trying to be set on a copy of a slice from a DataFrame
  </code></pre>
  
  <p>Hence I resort to initializing with empty lists and extending them as needed. There are a couple of methods I can think of to initialize this way, but is there a more straightforward way?</p>
  
  <p>Method 1:</p>
  
  <pre><code>df['empty_lists1'] = [list() for x in range(len(df.index))]
  
  &gt;&gt;&gt; df
     a  b   empty_lists1
  0  1  5             []
  1  2  6             []
  2  3  7             []
  </code></pre>
  
  <p>Method 2:</p>
  
  <pre><code> df['empty_lists2'] = df.apply(lambda x: [], axis=1)
  
  &gt;&gt;&gt; df
     a  b   empty_lists1   empty_lists2
  0  1  5             []             []
  1  2  6             []             []
  2  3  7             []             []
  </code></pre>
  
  <p><strong>Summary of questions:</strong></p>
  
  <p>Is there any minor syntax change that can be addressed in Issue 1 that can allow a list to be assigned to a <code>None</code>/<code>NaN</code> initialized field?</p>
  
  <p>If not, then what is the best way to initialize a new column with empty lists?</p>