I have a pandas df as displayed I would like to calculate Avg Rate by DC by Brand column which is a similar to averageif in excel , I have tried methods like groupby mean() but that does not give correct results
Your question is not clear but you may be looking for:
df.groupby(['DC','Brand'])['Rate'].mean()