If I have a DataFrame
such that:
pd.DataFrame( {\"name\" : \"John\",
\"days\" : [[1, 3, 5, 7]]
})
<
A 'native' pandas solution - we unstack the column into a series, then join back on based on index:
import pandas as pd #import
x2 = x.days.apply(lambda x: pd.Series(x)).unstack() #make an unstackeded series, x2
x.drop('days', axis = 1).join(pd.DataFrame(x2.reset_index(level=0, drop=True))) #drop the days column, join to the x2 series