title: Pyspark RDD "list index out of range" error
body: <p>I have RDD in this form:</p>
  
  <pre><code>[[['a'],['b,c,d','e,f,g']],[['h'],['i,j,k','l,m,n']]]
  </code></pre>
  
  <p>What I've wanted to achieve:</p>
  
  <pre><code>[['a ,b,c,d', 'a ,e,f,g'], ['h ,i,j,k', 'h ,l,m,n']]
  </code></pre>
  
  <p>What I did:</p>
  
  <pre><code>def pass_row(line):
    new_line = []
    key = ''.join(line[0])
    for el in line[1]:
      el = key +' ,'+ el
      new_line.append(el)
    return new_line
  
  rdd.map(pass_row)
  </code></pre>
  
  <p>It works for smaller samples of data. However, I am getting <code>list index out of range</code> on line <code>for el in line[1]:</code> when I try to run it on my whole dataset... </p>
  
  <p>Basically I have one key (lets say <code>['a']</code>) for ~100 different sets of values in <code>['b,c,d','e,f,g']</code>. My ultimate goal is to have it as spark dataframe in form of rows:</p>
  
  <pre><code>col1 col2 col3 col 4
  a     b    c    d
  a     e    f    g
  h     i    j    k
  h     l    m    n
  </code></pre>
  
  <p>Thank you for any advice!</p>