Vectorizing impossible operations
One of the most covered topics about pandas optimization is how to apply functions over columns. One option is to use
apply
but is not a good idea (maybe this is one of the topics with more posts ever). It’s known that the optimal solution is to use vectorization, however, some functions that can’t be vectorized easily. What to do in these cases?
Source: Vectorizing impossible operations: boolean algebra, sets, and filters, an article by Alex Molas.