Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

 I am from an SQL background was looking for the best way of doing this.

c = a.account_id.isin(b.account_id).astype(bool) 

a[c]

Is the above method efficient way?

1 Answer

0 votes
by (36.8k points)
edited by

Yes, it is, but we can put them into one row, and you do not need to convert isin output as bool since it is already bool type.

a[a.account_id.isin(b.account_id)]

Learn Data Science with Python Course to improve your technical knowledge.

Browse Categories

...