You could try (not sure if this qualifies for you as "nice")
# approach one
cols = [x for x in mtcars.columns if x.endswith("t")]
def f(x, cols):
for col in cols:
if "at" in col:
x[col] += 101
else:
x[col] += 100
return x
mtcars.apply(f, args=(cols,), axis=1)[cols].head(3)
# approach two
cols= [col for col in mtcars.columns if col.endswith("t")]
cols_w_at = [col for col in cols if "at" in col]
mtcars[cols] = mtcars[cols].apply(lambda x: x + 100)
mtcars[cols_w_at] = mtcars[cols_w_at].apply(lambda x: x + 1)
mtcars[cols].head(3)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…