A mapper function of the form,
def mapper(x): return [np.nan if np.isnan(y) else leader.loc[int(y), '1'] for y in x]
cols = ['3','4','5','6','7','8'] updated = DatasetLabel[cols].apply(mapper, axis=1) print(updated)
helps in getting around the quirk.