I have a dataset that have binary values for flags for each sinid like this:
>>> df = pd.DataFrame({'sinid':['abc','def','ghi','abc','ghi'],'flag1':[1,1,0,0,1],'flag2':[1,0,1,0,0]})
>>> df
sinid flag1 flag2
0 abc 1 1
1 def 1 0
2 ghi 0 1
3 abc 0 0
4 ghi 1 0
I want to add values for each sinid, I think I need groupby but not sure how to use it...
This is the expected result:
sinid flag1 flag2
0 abc 1 1
1 def 1 0
2 ghi 1 1