May-15-2017, 09:10 PM
If your subtotals were made as "running sums" (sums of consecutive amounts in same order) of your detail transaction's amounts , then it would be quite easy - you could do running sums on both detail and subtotal and use
For your data you can split your subtotal/detail dataframe by date (you can use groupby and zip) and then for each date try to find grouping of detail amounts that gives your subtotals. Finding that grouping is not a pandas problem; as it seems like more complicated variation of subset sum, it could be quite demanding for bigger amount of transactions.
pd.cut()
with label parameter equal to Ref to "split" your detail to appropriate parts. For your data you can split your subtotal/detail dataframe by date (you can use groupby and zip) and then for each date try to find grouping of detail amounts that gives your subtotals. Finding that grouping is not a pandas problem; as it seems like more complicated variation of subset sum, it could be quite demanding for bigger amount of transactions.