Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

keep only duplicates pandas multiple columns

df[df.duplicated(['col1', 'col2', 'col3'], keep=False)]
Comment

keep only one duplicate in pandas

import pandas as pd
df = pd.DataFrame({"A":["foo", "foo", "foo", "bar"], "B":[0,1,1,1], "C":["A","A","B","A"]})
df.drop_duplicates(subset=['A', 'C'], keep=False)
Comment

PREVIOUS NEXT
Code Example
Python :: numpy check if an array is all zero 
Python :: pdf to csv 
Python :: how to load mnist dataset in python 
Python :: string count substring occurences pytohn 
Python :: pathlib path get filename with extension 
Python :: compare two dictionaries in python 
Python :: remove tuple from list python 
Python :: count unique elements in list python 
Python :: python how to calculate how much time code takes 
Python :: kill python process with bash 
Python :: Accessing elements from a Python Dictionary 
Python :: python int to binary string 
Python :: declare empty array of complex type python 
Python :: find the difference in python 
Python :: python round to two decimals 
Python :: how to import your own function python 
Python :: python keep value recursive function 
Python :: random number generator in python 
Python :: Calculate Euclidean Distance in Python using distance.euclidean() 
Python :: python remove all elemnts in list containing string 
Python :: give a function a name python 
Python :: Display if the column(s) contain duplicates in the DataFrame 
Python :: python while loop 
Python :: telethon send image 
Python :: python subprocess exception handling 
Python :: checking if a string contains a substring python 
Python :: python create a pinging sound 
Python :: stack queue in python 
Python :: python count occurrences of an item in a list 
Python :: print(hello world) 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =