title: Adding new column to dataframe of different length from list
body: <p>I'm trying to add a new column to my dataframe for each time I run my funciton. This causes the error: 'ValueError: Length of values does not match length of index'. I assume this is because the list I add to df as a new column varies in length with every run of the function. </p>
  
  <p>I have seen many threads suggest using concad, but this probably won't work for me as I can't seem to use concad and just overwrite my existing df - and I need one complete df at the end with a column from each run of my function.</p>
  
  <p>My code functions like this:</p>
  
  <pre><code>df = DataFrame()
  mylist = []
  
  def myfunc(number):
      mylist = []
      for x in range(0,10):
          if 'some condition':
              mylist.append(x)
      df['results%d' % number] = mylist
  </code></pre>
  
  <p>So for each function iteration I'm adding contents of 'mylist' as a new dataframe column. At second iteration this causes above mentioned error. I need some way of letting python ignore index/column length. From the threads suggesting using concad, I get that passing that giving the instruction 'axis=1' fixes the problem of different lengths - so solution might be parallel to that.</p>
  
  <p>Alternative I could create a range of lists either before function definition or at beginning of it - one list for each 'number' parameter passed to the function, but this is a very primitive solution</p>