this is my code without any error
xl = pd.ExcelFile("D:/write_data.xlsx")
df = xl.parse("Sheet1")
df['C'] = df['C'].astype(str)
df = df.groupby(["A", "B", "C"])['C'].count()
df1 = df.groupby(["A", "B"]).sum()
df1.index = [df1.index.get_level_values(0), df1.index.get_level_values(1), ['MFA Total'] * len(df1)]
df.to_excel('D:/pandasout.xlsx')
but it did not give the subtotal simple data see below
please guide me on how I get the subtotal
regard's