Boolean Series key will be reindexed to match DataFrame index

Your approach will work despite the warning, but it’s best not to rely on implicit, unclear behavior. Solution 1, make the selection of indices in a_list a boolean mask: Solution 2, do it in two steps: Solution 3, if you want a one-liner, use a trick found here: The warning comes from the fact that the boolean vector df.a_col.isnull() is … Read more