How could I change all columns that have "change_" in the column name? For these columns I want to then conditionally replace rows. Want in general code for a larger dataset
df change_1 comment change_2
onee number two
three larger onee
[df[col].mask(df[col]=="onee","one") for col in df.columns if 'change_' in col]
Expected Output:
df change_1 comment change_2
one number two
three larger one