Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python - convert a list column into miltiple columns

# Method 1
df[['team1','team2']] = pd.DataFrame(df.column_with_list.tolist(), index= df.index)

# Method 2
df['team1'], df['team2'] = list(zip(*((x[0], x[1]) for x in df['column_with_list'].values)))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #convert #list #column #miltiple #columns
ADD COMMENT
Topic
Name
8+1 =