SyntaxFix
Write A Post
Hire A Developer
Questions
Alternative solution that uses .query() method:
In [5]: df.query("countries in @countries") Out[5]: countries 1 UK 3 China In [6]: df.query("countries not in @countries") Out[6]: countries 0 US 2 Germany