I have a data frame like this:
a b c
12456 11 123.1
12678 19 345.67
13278 19 1235.345
or in another format
<table><tr><td>12456</td><td>11</td><td>123.1</td></tr><tr><td>12678</td><td>19</td><td>345.67</td></tr><tr><td>13278</td><td>19</td><td>1235.345</td></tr>
</table>
The first column is the index.I need to add the rows of third column and make it one if second column has same value. Could you suggest me something to do this? Following is what I have tried but doesnt work
a,b,c=df_addweight.iloc[:,0].values,df_addweight.iloc[:, 1].values,df_addweight.iloc[:, 3].values`for u,v,w, in zip(range(1,len(a)),range(1,len(b)),range(1,len(c))):if a[u]==a[u-1] and b[v]==b[v-1]:df_addweight['W']= c[w]+c[w-1]elif a[u]==a[u-1] and b[v]!=b[v-1]:df_addweight['W']=c[w]