This is my dataframe:
df = pd.DataFrame({'ma':['a', 'b', 'c', 'd'], 'freq1':[1,2,3,4], 'phd':['x', 'y', 'a','b'], 'freq2':[6,7,8,9]})
I want to choose the part of df
that ma
and phd
have common values(that is a
and b
)
This is my desired outcome:
freq1 freq2 ma phd
0 1 8 a a
1 2 9 b b