There is some issue with variable_distances when you are calculating feature_dist for cat columns, you are not appending the result anywhere? only continuous columns feature_dist is getting append in variable_distances?
Please check, the variable_distances.append(feature_dist) should be out of if else scope I guess