Adi  70   math's     Bangalore    2022
vira 80   math's     Bangalore    2022
Adi  30   English    Bangalore    2022
Result
Adi 100 maths bangalore 2022
Adi  70   math's     Bangalore    2022
vira 80   math's     Bangalore    2022
Adi  30   English    Bangalore    2022
Result
Adi 100 maths bangalore 2022
 
    
     
    
    Assuming maths in the result is a typo and you want to sum up all marks for a given name/city/year combination,
import io
import pandas as pd
df = pd.read_csv(io.StringIO("""
Adi;70;math's;Bangalore;2022
vira;80;math's;Bangalore;2022
Adi;30;English;Bangalore;2022
""".strip()), sep=";", names=["name", "marks", "subject", "city", "year"])
gdf = df.groupby(["name", "city", "year"]).agg({"marks": "sum"}).reset_index()
print(gdf)
   name       city  year  marks
0   Adi  Bangalore  2022    100
1  vira  Bangalore  2022     80
