title: Unable to group by() and sum() in Python
body: <p>I have this dataframe where I have multiple PatientID because of different visits. I am trying to calculate sum of refills per Patient regardless of the visit</p>
  
  <p>My data looks like this</p>
  
  <pre><code>PatientID   refills_auth
  000BE424-54C2   0
  000BE424-54C2   0
  000BE424-54C2   0
  000BE424-54C2   1
  000BE424-54C2   1
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   1
  0011A43B-9638   1
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   3
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  0011A43B-9638   0
  
  
  InfoScrbRefSum.groupby(['PATID']).sum().groupby('PATID').sum()
  
  </code></pre>
  
  <p>and the result looks like this</p>
  
  <pre><code>PatientID   refills_auth
  000BE424-54C2    00011
  0011A43B-9638    1000011000000...
  </code></pre>
  
  <p>Some of the Sum are populated correctly others are not - Here is what I get for some rows</p>
  
  <p>Any help is highly appreciated</p>
  
  <p>Thanks
  <a href="https://i.stack.imgur.com/Teck5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Teck5.png" alt="enter image description here"></a>
    <a href="https://i.stack.imgur.com/Z7PJd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z7PJd.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/80lDR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/80lDR.png" alt="enter image description here"></a></p>