I have the following DataFrame:
df = pd.DataFrame(list(zip([1,2],
[5,6],
[9,10],
[13,14])))
df.columns =['x_A', 'y_A', 'x_B', 'y_B']
df:
x_A y_A x_B y_B
0 1 5 9 13
1 2 6 10 14
I would like to divide columns with similar prefixes to get the following:
df:
x y
0 1/9 5/13
1 2/10 6/14
Can this be done with a single line if possible?
Thank you.