Skip to content

Instantly share code, notes, and snippets.

@anbento0490
Last active May 2, 2020 17:38
Show Gist options
  • Save anbento0490/9d027d6a7dbba571dfbdb51ba7b20c38 to your computer and use it in GitHub Desktop.
Save anbento0490/9d027d6a7dbba571dfbdb51ba7b20c38 to your computer and use it in GitHub Desktop.
#4.SUM(...) over(partition by ... order by .. rows unbounded preceding) --> CUMSUM()
orders["Run Tot (£)"] = orders.groupby(['Customer ID', 'Order Month'])['Amount Paid (£)'].cumsum()
orders.head(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment