Skip to content

Instantly share code, notes, and snippets.

@ericness
Created August 22, 2018 21:55
Show Gist options
  • Save ericness/2f4ab0d65e6ccc488b9a4c816da5a2cb to your computer and use it in GitHub Desktop.
Save ericness/2f4ab0d65e6ccc488b9a4c816da5a2cb to your computer and use it in GitHub Desktop.
Reindex the DataFrame so that missing dates are filled in will zero values.
daily_orders = daily_orders.reindex(customer_date_index, fill_value=0)
daily_orders['running_amount'] = (
daily_orders
.reindex()
.groupby('customer')
.cumsum()
)
print(daily_orders)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment