title: splitting multiple columns using lambda
body: <p>I'm trying to split the values in these columns but it keeps returning &quot;list index out of range&quot;</p>
  <pre><code>
  for c in new_col:
      df1[c] = df1[c].apply(lambda x: x.split(&quot;/&quot;)[0])
      df2[c] = df2[c].apply(lambda x: x.split(&quot;/&quot;)[1])```
  
  
  Input In [46], in &lt;lambda&gt;(x)
        4 for c in new_col:
        5     df1[c] = df1[c].apply(lambda x: x.split(&quot;/&quot;)[0])
  ----&gt; 6     df2[c] = df2[c].apply(lambda x: ***x.split(&quot;/&quot;)[1])***
  
  IndexError: list index out of range
  </code></pre>