The second condition allows the control to enter the “if” block even if the column don’t have any missing value and inside the “if” block the control ends up adding an extra column with all the values as false because the column is found in the “na_dict”. Also, it returns the same “na_dict” as the one passed to it (in such situations).
The Image shows the code to reproduce the bug. If the column don’t have missing values and its name is present in “na_dict” then it adds extra column with all “False”. I guess this is not an intended behavior. Correct me if I have missed any other possible scenario where the second condition is useful.
Simply removing the second condition gives us the intended result.