I'm new with python and pandas so here's my question:
I have two dataframes, df1 has two columns one for labels and one for integers which correspond to the Toal of each label while df2 contains the quantity used by day. I would like to subtract each row of df2 until df1 is equal or closer to 0 and add a column to df1 the date of the last row subtracted (it could be in a new dataframe df3). The subtraction needs to have two conditions where:
- labels need to be equal
- subtraction can not be minor to 0
df1 = DF with Totals
df2 = DF with quantities
I hope someone can help me.