SHARE
TWEET

Untitled

a guest Jun 15th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. df %>%
  2. group_by(col_a, col_b) %>%
  3. summarise( a = sum(col_a == 'a'),
  4.       b = sum(col_a == 'b'),
  5.       c = b/a
  6. )
  7.      
  8. df.groupby('id').agg({'out':[lambda x:sum(x==4)]})
  9.      
  10. df.assign(out=df.out==4).groupby('id').agg({'out':sum})
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top