data science student
If I understood your question correctly, you can do something like:

import numpy as np

columns = ['median', 'p25th', 'p75th']
df[columns] = df[columns].replace(r'UN', np.nan, regex=True)