im quite new to python. i just wanna know what is the best way to select certain columns based on values on a row.
c = pd.DataFrame(np.arange(12).reshape(4,3))
c
Out[1]:
0 1 2
0 0 1 2
1 3 4 5
2 6 7 8
3 9 10 11
say i want to select the columns whose second row's value is larger than 3.
It seems c.loc[:,c.loc[1]>3] works for me. Is it the most efficient way? or any other way to achieve this?