Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

drop values in column with single frequency

counts_col2 = df.groupby("Col2")["Col2"].transform(len)
counts_col3 = df.groupby("Col3")["Col3"].transform(len)

mask = (counts_col2 > 5) & (counts_col3 > 5)

df[mask]
Comment

PREVIOUS NEXT
Code Example
Python :: Kinesis Client get_records response json 
Python :: var person 
Python :: df.loc 
Python :: how to filter csv file by columns 
Python :: python how to acquire the html code for a website 
Python :: how to export schema in graphene django 
Python :: python youtube view bot 
Python :: how to see if something is in a class in python 
Python :: check version of various pkgs 
Python :: a.all() numpy 
Python :: python ufeff character from file 
Python :: get multiples of a number between two numbers python 
Python :: =adaqtar 
Python :: how to remove na values in r data frame 
Python :: timeplanner-1 
Python :: Tuples as return values 
Python :: comprehensions 
Python :: combining list alternatively 
Python :: pool does not print process id 
Python :: nibabel expand dimension 
Python :: scrapy capture: Error downloading 
Python :: python three periods 
Python :: python generator for reading and writing file 
Python :: fix misspelled in Wikipedia library on python 
Python :: import baseestimator 
Python :: python 3.10 windows 7 
Python :: create a dictionary from dataframe 
Python :: length of a list python 
Python :: remove nan from list 
Python :: append multiple elements python 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =