title: How does Pandas groupby cumsum work differently from groupby sum?
body: <p>I have a dataset where there may be multiple subscriptions under a single Project Code, similar to the one created below:</p>
  <pre><code>data = {'Project Code': [1622, 1622,1622,1622,1622,1622,1622,1622],
  'Subscription Line': [1,2,1,2,1,2,1,1]
  'Date': [4/1/2020, 4/1/2020, 5/1/2020, 5/1/2020, 6/1/2020, 6/1/2020, 7/1/2020, 8/1/2020],
  'Subscription Spend': [ 293, 195, 31, 200, 0, 0, 3270,184],
  'Projected Subscription Spend': [11758, 8970, 12261, 6807, 9963, 5480, 11885, 9900],
  'Project-Month':['1622April2020', ' 1622April2020', '1622May2020', '1622May2020', '1622June2020', '1622June2020', '1622July2020', '1622August2020']
  }
  df = pd.DataFrame (data, columns = ['Project Code', 'Date', 'Subscription Spend', 'Projected Subscription Spend', 'Project-Month'])
  </code></pre>
  <p>I want to calculate a column which calculates the Project-level Projected Spend as the sum of the 'Projected Subscription Spend'. So for April 2020 the Projected Project Spend would be 11,758 + 8,970 = 20,728, and this would be shown for both rows. So the Projected Project Spend would look like this:</p>
  <pre><code>'Projected Project Spend' = [20728, 20728, 19068, 19068, 15443, 15443, 11885, 9900]
  </code></pre>
  <p>I have tried to do this using groupby and sum, but when I ran the code I got blanks in 'Projected Project Spend'. However when I used cumsum I got values that function in the way you would expect cumsum to- they add up over time. The two lines of code I tried are below:</p>
  <pre><code>df['Projected Project Spend'] = (df['Subscription Spend']).groupby(df['Subscription Code']).sum()
  df['Projected Project Spend'] = (df['Projected Subscription Spend']).groupby(df['Project-Month']).cumsum()
  </code></pre>
  <p>Why would sum have null output when cumsum doesn't? How can I make sum work?</p>