Advertisement
elena1234

Delete rows with low frequency values in Python

Oct 20th, 2023
749
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | Source Code | 0 0
  1. # Delete rows with low frequency values
  2. col = 'ap_lo'
  3. n = 142    
  4. df = df[df.groupby(col)[col].transform('count').ge(n)]
  5. df['ap_lo'].value_counts()
  6.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement