I am trying to get it so that as I loop over a list of things I can add into a dataframe the quantity received from each warehouse on a certain date.
When I try the following it doesn't work:
if inv['prod'] not in self.inventory.columns:
    ## add row in
    self.inventory[inv['prod']] = 0
    idx = inv['time_stamp'].split(' ')[0]
    if idx not in self.inventory.index:
        self.inventory[idx, :] = 0
    self.inventory[idx, inv['prod']] += inv['qty'] 
I basically need it to add a column based on each product and then the date it arrives/sold. I know this is not very pythonic but just take it that I don't know in advance the dates or else the products in advance.
data frame will look like this by the end:
Date         InventoryA       InventoryB
2017-01-01       10              NaN
2017-01-02       NaN             NaN
2017-01-03       NaN              5
2017-01-04       NaN              5
2017-01-05       -5              NaN
2017-01-06       NaN             -10
2017-01-07       15              NaN
2017-01-08       NaN             NaN
2017-01-09      -20              NaN
 
    