Ok, I will send it again for more information and other ingenious solutions, please check link1 and link2
df.set_index(['Dep','Exp','Fl-No'])['Shared Codes'].apply(pd.Series).stack().reset_index().drop('level_3',1)
Dep Exp Fl-No Shared Codes
0 20:58 20:55 LX 736 No shared codes
1 21:23 20:55 LX 818 Dummy
2 21:23 20:55 LX 818 LH 5809
3 21:27 21:00 JU 375 No shared codes
4 21:28 21:00 LX 770 Dummy
5 21:28 21:00 LX 770 SN 5102
6 21:31 21:10 LX 1842 Dummy
7 21:31 21:10 LX 1842 LH 5880
8 21:31 21:10 LX 1842 TP 8184
9 21:31 21:10 LX 1842 A3 1985
Also, using pd.wide_to_longHowever, personally it is not recommended to call bust.
df1=df['Shared Codes'].apply(pd.Series)
df1.columns='sur'+df1.columns.astype(str)
df=pd.concat([df,df1],axis=1)
pd.wide_to_long(df,['sur'],['Dep','Exp','Fl-No'],'lol').reset_index().drop(['lol','Shared Codes'],axis=1).dropna()
Dep Exp Fl-No Shared Codes
0 20:58 20:55 LX 736 No shared codes
1 21:23 20:55 LX 818 Dummy
2 21:23 20:55 LX 818 LH 5809
3 21:27 21:00 JU 375 No shared codes
4 21:28 21:00 LX 770 Dummy
5 21:28 21:00 LX 770 SN 5102
6 21:31 21:10 LX 1842 Dummy
7 21:31 21:10 LX 1842 LH 5880
8 21:31 21:10 LX 1842 TP 8184
9 21:31 21:10 LX 1842 A3 1985
source
share