Advertisement
AliaksandrLet

pivot_table

May 3rd, 2022 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. # Рассмотрим данные в общем виде
  2. pivot_df = pd.pivot_table(
  3.     df,
  4.     index=['purpose_category', 'total_income_category'],
  5.     columns='children',
  6.     values='debt',
  7.     aggfunc=[len, np.sum],
  8.     fill_value=0,
  9.     margins=True
  10. )
  11. pivot_df
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement