pandas sum rows if condition code example Example: pandas dataframe sum with condition subset_df = df[df["A"] > 3] column_sum = subset_df.sum()