Given this example dataframe in Pandas
df2 = pd.DataFrame({'a' : ['one', 'two', 'three', 'four', 'five', 'six', 'seven'],
'b' : ['x', 'y', 'y', 'x', 'y', 'x', 'x'],
'c' : ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu']})
looking like
a b c
0 one x abc
1 two y def
2 three y ghi
3 four x jkl
4 five y mno
5 six x pqr
6 seven x stu
I would like to build a new by concatenating e.g. rows 2 & 3 to get something like
two_three y_y def_ghi
0 one x abc
1 two y def
2 three y ghi
3 four x jkl
4 five y mno
5 six x pqr
6 seven x stu
Any idea for a vector-like realization?
Thanks a lot, Sascha