Pandas: split column of lists of unequal length into multiple columns : <p>I have a Pandas dataframe that looks like the below:</p>

<pre><code>                   codes
1                  [71020]
2                  [77085]
3                  [36415]
4                  [99213, 99287]
5                  [99233, 99233, 99233]
</code></pre>

<p>I'm trying to split the lists in <code>df['codes']</code> into columns, like the below:</p>

<pre><code>                   code_1      code_2      code_3   
1                  71020
2                  77085
3                  36415
4                  99213       99287
5                  99233       99233       99233
</code></pre>

<p>where columns that don't have a value (because the list was not that long) are filled with blanks or NaNs or something.</p>

<p>I've seen answers like <a href="https://stackoverflow.com/questions/35491274/pandas-split-column-of-lists-into-multiple-columns">this one</a> and others similar to it, and while they work on lists of equal length, they all throw errors when I try to use the methods on lists of unequal length. Is there a good way do to this?</p>
