You can use the logical condition to create a mask and pass a list of quantities of interest using loc
:
frame.loc[frame['DESIGN_VALUE'] > 20,['mycol3', 'mycol6']]
I advise above because it means that you are working with a view, not a copy, and secondly, I also strongly suggest using it []
to select columns, and not as attributes using the sot operator, .
this avoids the ambiguity in the behavior of pandas
:
In [184]:
df = pd.DataFrame(columns = list('abc'), data = np.random.randn(5,3))
df
Out[184]:
a b c
0 -0.628354 0.833663 0.658212
1 0.032443 1.062135 -0.335318
2 -0.450620 -0.906486 0.015565
3 0.280459 -0.375468 -1.603993
4 0.463750 -0.638107 -1.598261
In [187]:
df.loc[df['a']>0, ['b','c']]
Out[187]:
b c
1 1.062135 -0.335318
3 -0.375468 -1.603993
4 -0.638107 -1.598261
:
frame[(frame.DESIGN_VALUE > 20) & (frame['mycol3','mycol6']))]
, - df , , &