我有三个数据集:
Fact
= 1的行(无论标签为0)来构建df2 ;df1
User Label Fact Date
321 1 0 28-04
312 1 0 22-02
315 1 0 21-12
...
df2
User Label Fact Date
21 0 1 18-04
532 0 1 02-01
135 0 1 22-12
...
df
User Label Fact Date
321 1 0 28-04
312 1 0 22-02
315 1 0 21-12
...
21 0 1 18-04
532 0 1 02-01
135 0 1 22-12
...
241 0 0 21-12
54 0 0 23-11
...
我想知道如何Label=0 and Fact = 0
使用连接来“提取”数据集。由于我对条件感兴趣,因此Label=0 and Fact = 0
我只能使用逻辑条件来提取行,但是我对可能的替代方案感到好奇。
谢谢
df[(df["Label"]==0) & (df["Fact"]==0)]
应该给您您想要的东西,或者也df2[df2["Label"]==0]
。但是,您所说的可能替代品是什么意思?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句