Page 22 sur 25
Split column and get a element
Here, splitting with a comma (str.split(',')) and get the first element (.str[0]):
[code]df['element'] = df['Myfield'].str.split(',').str[0][/code]
Split column without to know how many column will result
[code]df = pd.concat([
df['id'],
df['Field1'],
df['Field1'].str.split(';', expand=True).add_prefix('Field1_'),
df['Field2'],
df['Field2'].str.split(';', expand=True).add_prefix('Field2_')
], axis=1 )[/code]