Put `mask_val = col.fill_values[masked]` above and then `col.str_vals[i] = mask_val` here.  That saves two dict lookups in this inner loop.