Splitting a list in a Pandas cell into multiple columns
<p>I have a really simple <code>Pandas</code> <code>dataframe</code> where each cell contains a list. I'd like to split each element of the list into it's own column. I can do that by exporting the values and then creating a new <code>dataframe</code>. This doesn't seem like a good way to do this especially, if my <code>dataframe</code> had a column aside from the list column.</p>

<pre><code>import pandas as pd

df = pd.DataFrame(data=[[[8,10,12]],
                        [[7,9,11]]])

df = pd.DataFrame(data=[x[0] for x in df.values])
</code></pre>

<p>Desired output:</p>

<pre><code>   0   1   2
0  8  10  12
1  7   9  11
</code></pre>

<p>Follow-up based on @Psidom answer:</p>

<p>If I did have a second column:</p>

<pre><code>df = pd.DataFrame(data=[[[8,10,12], 'A'],
                        [[7,9,11], 'B']])
</code></pre>

<p>How do I not loose the other column?</p>

<p>Desired output:</p>

<pre><code>   0   1   2  3 
0  8  10  12  A
1  7   9  11  B
</code></pre>