Pandas add new column as "agregation" of different columns but counting them as 1 in case value > 0

Solution 1:

I guess aggregation is sum? But in anycase you can do your aggregation across the columns and check if > 0 and cast it to int as you want 0 and 1 not True and False. So something like

columns = ["col1", ...] # if you only need some columns
df["newcolumn"] = (df[colums] > 0).sum(axis=1).astype(int)