Jun-19-2018, 07:52 AM
Probably, what you are looking for is an inner-join operation:
df2=df.loc[[1],['c3']].reset_index().drop('index', axis=1) df1=df.loc[[0],['c1','c2']].reset_index().drop('index', axis=1) result3 = pd.concat([df1, df2], join='inner', axis=1) result3
Output: c1 c2 c3
0 1 1 6
Note, you can do the same more easily,e.g.df2=df.loc[[1],['c3']].reset_index() df1=df.loc[[0],['c1','c2']].reset_index() result3 = df1.copy() result3['c3'] = df2.c3.values