Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. df_by_plan = (df[(df.billing_reason != "manual") & ((df.status != 'draft') & (df.status != 'void'))]
  2. .groupby([pd.Grouper(key="created",freq="M"),"subscription.plan.id"])
  3. .agg(
  4. {
  5. "amount_due": "sum",
  6. "amount_paid": "sum",
  7. "customer_email": pd.Series.nunique
  8. }
  9. )
  10. )
  11. df_by_plan.rename(columns={"customer_email": 'customers'},inplace=True)
  12. df_by_plan
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement