Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

delete rows in a table that are present in another table pandas

print (pd.merge(a,b, indicator=True, how='outer')
         .query('_merge=="left_only"')
         .drop('_merge', axis=1))
   0   1
0  1  10
2  3  30
Comment

delete rows in a table that are present in another table pandas

print (pd.merge(a,b, indicator=True, how='outer')
         .query('_merge=="left_only"')
         .drop('_merge', axis=1))
   0   1
0  1  10
2  3  30
Comment

remove rows from a dataframe that are present in another dataframe?

df.loc[~((df.Product_Num.isin(df2['Product_Num']))&(df.Price.isin(df2['Price']))),:]
Out[246]: 
    Product_Num     Date  Description  Price
0            10   1-1-18  FruitSnacks   2.99
1            10   1-2-18  FruitSnacks   2.99
4            10  1-10-18  FruitSnacks   2.99
5            45   1-1-18       Apples   2.99
6            45   1-3-18       Apples   2.99
7            45   1-5-18       Apples   2.99
11           45  1-15-18       Apples   2.99
Comment

remove rows from a dataframe that are present in another dataframe?

df.loc[~((df.Product_Num.isin(df2['Product_Num']))&(df.Price.isin(df2['Price']))),:]
Out[246]: 
    Product_Num     Date  Description  Price
0            10   1-1-18  FruitSnacks   2.99
1            10   1-2-18  FruitSnacks   2.99
4            10  1-10-18  FruitSnacks   2.99
5            45   1-1-18       Apples   2.99
6            45   1-3-18       Apples   2.99
7            45   1-5-18       Apples   2.99
11           45  1-15-18       Apples   2.99
Comment

PREVIOUS NEXT
Code Example
Python :: django oauth toolkit permanent access token 
Python :: set environment variable flask app 
Python :: Code of recursive binary search 
Python :: python string cut first n characters 
Python :: import stock data from yahoo finance 
Python :: destroy label tkinter 
Python :: pandas convert string column to int list column 
Python :: how to add values to a list in python 
Python :: beautifulsoup find element by partial text 
Python :: pygame text wrapping 
Python :: python 2.7 datetime to timestamp 
Python :: run python script from repl 
Python :: how to convert pandas series to 2d numpy array 
Python :: select default option django form 
Python :: python add comma each 3 digits format 
Python :: python variable is not none 
Python :: subprocess.popen no output 
Python :: vscode in browser github 
Python :: python pandas how to get the dataframe size 
Python :: get output from transaction in brownie 
Python :: prime number checking algorithm 
Python :: HUNGRY CHEF codechef 
Python :: django cleanup settings 
Python :: python run code at the same time 
Python :: dropna pandas 
Python :: reversed python 
Python :: install poetry on linux 
Python :: python machine learning scale 
Python :: fibinacci python 
Python :: re.sub in python example 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =