title: Filling Pandas columns with lists of unequal lengths
body: <p>I am having trouble filling Pandas dataframes with values from lists of unequal lengths.</p>
  
  <p><code>nx_lists_into_df</code> is a list of numpy arrays.</p>
  
  <p>I get the following error: </p>
  
  <blockquote>
    <p>ValueError: Length of values does not match length of index</p>
  </blockquote>
  
  <p>The code is below:</p>
  
  <pre><code># Column headers
  df_cols = ["f1","f2"]
  
  # Create one dataframe fror each sheet
  df1 = pd.DataFrame(columns=df_cols)
  df2 = pd.DataFrame(columns=df_cols)
  
  # Create list of dataframes to iterate through
  df_list = [df1, df2]
  
  # Lists to be put into the dataframes   
  nx_lists_into_df = [[array([0, 1, 3, 4, 7]),
                       array([2, 5, 6, 8])],
                      [array([0, 1, 2, 6, 7]),
                       array([3, 4, 5, 8])]]
  
  # Loop through each sheet (i.e. each round of k folds)
  for df, test_index_list in zip_longest(df_list, nx_lists_into_df):
      counter = -1
      # Loop through each column in that sheet (i.e. each fold)
      for col in df_cols:
          print(col)
          counter += 1
          # Add 1 to each index value to start indexing at 1
          df[col] = test_index_list[counter] + 1
  </code></pre>
  
  <p>Thank you for your help.</p>
  
  <p>Edit: This is how the result should hopefully look:-</p>
  
  <pre><code>print(df1)
  
     f1   f2
  0   0    2
  1   1    5
  2   3    6
  3   4    8
  4   7  NaN
  
  print(df2)
  
     f1   f2
  0   0    3
  1   1    4
  2   2    5
  3   6    8
  4   7  NaN
  </code></pre>