I have a data frame as follows,
df2 = pd.DataFrame({'a' : ['one', 'one', 'two', 'three', 'two', 'one', 'six'],
'b' : ['x', 'y', 'y', 'x', 'y', 'x', 'x'],
'c' : np.random.randn(7)})
I want to select data from df2 where column 'a' equals 'two' or 'three', my code is as follows,
df2[df2['a']=='two'or df2['a']=='three']
Could anyone give me some light on why my code doesn't work?
Error: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Thanks in advance!