I have the following (simplified) data;
import pandas as pd
a = [['10', '12345', '4'], ['15', '78910', '3'], ['8', '23456', '10']]
b = [['10', '12345'], ['15', '78910'], ['9', '23456']]
df_a = pd.DataFrame(a, columns=['id', 'sku', 'quantity '])
df_b = pd.DataFrame(b, columns =['id','sku'])
I need to compare the 'id and 'sku' columns from both dataframes and for those that match I need to update df_a['quantity']
to equal '0'.
So, something like an if statement?
if (df_a['id'] == df_b['id']) and (df_a['sku'] == df_b['sku']):
df_a['quantity']=0