2 Comments
User's avatar
André Mejia Grijó's avatar

Awesome tips man! But this one can be done with raw function called "query". You can easily select anything from your df with df.query("city == yourcity), specify variables or even functions.

Expand full comment
Avi Chawla's avatar

Of course, that is a pretty handy function too. But it isn't SQL, no? I wanted to purpose this tip for someone who's looking to leverage pure SQL syntax with pandas. I have especially found it useful in places where Pandas does not support an easier way—conditional joins, for instance. SQL offers much more flexibility for joins so that is when I used this. Hope you get the point :).

Expand full comment