Split a text column into multiple column based on some delimiter.

In [1]:
import pandas as pd

In [2]:
data = [{'test': 'vikash|Arpit', 'val': 6},
        {'test': 'vikash_1|arpit|Vinayp', 'val': 3},
        {'test': 'arpit|vinayp', 'val': 2}]

In [3]:
df = pd.DataFrame.from_dict(data, orient='columns')

In [4]:
df


Out[4]:
test val
0 vikash|Arpit 6
1 vikash_1|arpit|Vinayp 3
2 arpit|vinayp 2

In [5]:
df['test'].apply(lambda x: pd.Series([i for i in reversed(x.lower().split('|'))]))


Out[5]:
0 1 2
0 arpit vikash NaN
1 vinayp arpit vikash_1
2 vinayp arpit NaN

In [ ]: