Thanks for helping out. Greatly appreciated. I have looked through S.O. and couldn't quite get the answer i was hoping for.
i have data frame with columns that i would like to sum, but would like to exclude based on wildcard (so am hoping to include based on wildcard but also exclude based on wildcard)
My columns include: "dose_1", "dose_2", "dose_3"... "new_dose" + "infusion_dose_1" + "infusion_dose_2" + many more similarly
I understand if i want to sum using wildcard, i can do
df['new_column'] = df.filter(regex = 'dose').sum(axis = 1)
but what if i want to exclude columns that contains str "infusion"?
Appreciate it!