title: I have two columns in a pandas dataframe. One column has some same values (id) and corresponding values in another column has Number of tickets
body: <pre><code>   id         n_tickets
  0  1586391          2
  1   640             2
  2   640             1
  3  1181593          2
  4   964842          1
  5    780            1
  6    780            1  
  </code></pre>
  
  <p>I have the above data frame. As you can see that in id column 640 and 780 have occurred two times. I want that just a single occurrence remains but there corresponding values in column n_tickets gets added up. My final dataframe should look like this: </p>
  
  <pre><code>     id         n_tickets
  0  1586391          2
  1   640             3
  2  1181593          2
  3   964842          1
  4    780            2 
  </code></pre>
  
  <p>I am using the code: <code>df_tickets.groupby(['id','n_tickets']).sum()</code>but I am gettting the error:</p>
  
  <pre><code>Empty DataFrame
  Columns: []
  Index: []
  </code></pre>
  
  <p>when i use the below code:</p>
  
  <pre><code>df_tickets.groupby('id',sort=False).sum().reset_index()
  
  print(df_tickets.loc[df_tickets['id'] == 780])
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>        id     n_tickets
  425166  780          1
  985855  780          1
  </code></pre>
  
  <p>Instead I should get:</p>
  
  <pre><code>           id    n_tickets
     425166  780      2
  </code></pre>