Page 23 sur 27
Split column and get a element
Here, splitting with a comma (str.split(',')) and get the first element (.str[0]):
df['element'] = df['Myfield'].str.split(',').str[0]
Split column without to know how many column will result
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 )