Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas get rows which are NOT in other dataframe

In [119]:

common = df1.merge(df2,on=['col1','col2'])
print(common)
df1[(~df1.col1.isin(common.col1))&(~df1.col2.isin(common.col2))]
   col1  col2
0     1    10
1     2    11
2     3    12
Out[119]:
   col1  col2
3     4    13
4     5    14
Comment

PREVIOUS NEXT
Code Example
Python :: django prevent duplicate entries 
Python :: python re.sub() 
Python :: attributes in python 
Python :: panda lambda function returns dataframe 
Python :: list slice in python 
Python :: cv2 assertion failed 
Python :: from a list of lists - find all length of list 
Python :: python reverse dictionary 
Python :: re.sub 
Python :: pandas join dataframe 
Python :: count in python 
Python :: max value of a list prolog 
Python :: push button raspberry pi 
Python :: Python RegEx re.compile() 
Python :: order_by django queryset order by ordering 
Python :: python append value to column 
Python :: giving number of letter in python 
Python :: field in django 
Python :: pandas replace values from another dataframe 
Python :: how to do more than or less than as a condition in pythonb 
Python :: python string: .strip() 
Python :: clear 
Python :: selecting a specific value and corrersponding value in df python 
Python :: replace nan from another column 
Python :: all function in python 
Python :: pandas how to read csv 
Python :: youtube mp3 downloader python 
Python :: How To Remove Elements From a Set using remove() function in python 
Python :: python new 
Python :: return max(max(a,b),max(c,d)); 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =