Pandas split column into multiple columns by comma
<p>I am trying to split a column into multiple columns based on comma/space separation.</p>

<p>My dataframe currently looks like</p>

<pre><code>     KEYS                                                  1
0   FIT-4270                                          4000.0439
1   FIT-4269                                          4000.0420, 4000.0471
2   FIT-4268                                          4000.0419
3   FIT-4266                                          4000.0499
4   FIT-4265                                          4000.0490, 4000.0499, 4000.0500, 4000.0504,
</code></pre>

<p>I would like</p>

<pre><code>   KEYS                                                  1           2            3        4 
0   FIT-4270                                          4000.0439
1   FIT-4269                                          4000.0420  4000.0471
2   FIT-4268                                          4000.0419
3   FIT-4266                                          4000.0499
4   FIT-4265                                          4000.0490  4000.0499  4000.0500  4000.0504 
</code></pre>

<p>My code currently removes The KEYS column and I'm not sure why. Could anyone improve or help fix the issue?</p>

<pre><code>v = dfcleancsv[1]

#splits the columns by spaces into new columns but removes KEYS?

dfcleancsv = dfcleancsv[1].str.split(' ').apply(Series, 1)
</code></pre>