I want to create a self updating dataframe but am having trouble specifying the row

I have two dataframes,

stock=WrappedDataFrame(pd.DataFrame(columns=['id','item','stock','price_buy','best_seller','price_sell']))
restocks=WrappedDataFrame(pd.DataFrame(columns=['id','date','item','restock_num']))

And let’s say I have this: [0,'Sprite',34,2500,'Yes',3000] row in stock
I want to make it so if a row like this: [0,'2020/10/23','Sprite',45] is entered into the restocks dataframe, it automatically updates the column stock in stock. I’ve already taken care of the auto-update part, but I want to make sure that if the correct thing is updated.

Because if I put this: [0,'2020/10/23','Coke',32] row in restocks, it will update this: [0,'Sprite',34,2500,'Yes',3000] row which is not what I want to happen.

Basically checking to see if the item in the stock row matches the item in the restocks before I update the stock column.

sounds like you have to write a function and/or use .compare() to compare the DFs.

Or, add a date col to the stocks df(?)

1 Like

Can you elaborate on this?