def reconcile_with_stock_levels(self, needed_sales_share_levels, needed_sales_names): if not set(needed_sales_names).issubset(self.values.index.names): # we can't have more specificity in sales share than in stock raise ValueError('Sales share expressed as an intensity cannot have levels not in stock') # pick up extra levels self.values = util.expand_multi(self.values, needed_sales_share_levels, needed_sales_names).sort_index()
def reconcile_with_stock_levels(self, needed_sales_share_levels, needed_sales_share_names): if self.input_type == 'intensity': if not set(self.values.index.names).issubset(needed_sales_share_names): # we can't have more specificity in sales share than in stock raise ValueError('Sales share expressed as an intensity cannot have levels not in stock') # pick up extra levels self.values = util.expand_multi(self.values, needed_sales_share_levels, needed_sales_share_names).sort_index() self.values.fillna(0, inplace=True) elif self.input_type == 'total': raise ValueError( 'A sales share type of total is not currently supported. Please normalize to sales share as a percentage')