Splitting columns by patterns is easy:
import pandas as pd
_df = pd.DataFrame([['1 / 2 / 3', '4 / 5 / 6'], ['7 / 8 / 9', '10 / 11 / 12']])
_df.apply(lambda x: x.str.split(' / '))
0 1
0 [1, 2, 3] [4, 5, 6]
1 [7, 8, 9] [10, 11, 12]
But how can I create a dataframe using expand=True as multiindex? I do not know where I could pass the index.
_df.apply(lambda x: x.str.split(' / ', expand=True))
ValueError: If using all scalar values, you must pass an index
Expected output (names of columns are not important, can be arbitrary):
A B
a b c a b c
0 1 2 3 4 5 6
1 7 8 9 10 11 12