Reputation: 69
I have to do, maybe a simple thing, but I completely don't know how. I have some code:
data = df_new.assign(result=df_new['text'].isin(df_oryginal['text']).astype(str))
df_same = pd.DataFrame(data)
and the output is:
text name index result
0 some text filename 0 False
1 some text filename 1 True
2 some text filename 2 False
3 some text filename 3 False
4 some text filename 4 True
... ... ... ... ...
36213 some text filename 36213 False
36214 some text filename 36214 False
36215 some text filename 36215 True
Now I would like select only these rows where df_same['result'] == True, but I don't know how. I have looked all over Google... Please help me, thank you in advance for your answer :)
Upvotes: 3
Views: 31776
Reputation: 111
result_df= df.loc[df['result']==True]
result_df will contain the rows which satisfies your condition having result True
Upvotes: 11