Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. df_children_debt = df[['children', 'debt', 'family_status']]
  2. df_pivot = df_children_debt.pivot_table(index ='children', columns = 'debt', values = 'family_status', aggfunc ='count')
  3. df_pivot
  4.  
  5. #ВЫВОД:
  6. debt    0   1
  7. children       
  8. 0   13132.0 1064.0
  9. 1   4374.0  444.0
  10. 2   1929.0  202.0
  11. 3   303.0   27.0
  12. 4   37.0    4.0
  13. 5   9.0 NaN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement