我有一个数据框如下,
df2 = pd.DataFrame({'a' : ['one', 'one', 'two', 'three', 'two', 'one', 'six'],
'b' : ['x', 'y', 'y', 'x', 'y', 'x', 'x'],
'c' : np.random.randn(7)})
我想从 df2 中选择“a”列等于“二”或“三”的数据,我的代码如下,
df2[df2['a']=='two'or df2['a']=='three']
谁能告诉我为什么我的代码不起作用?
错误:Series 的真值不明确。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()。
提前致谢!