diff --git a/app/services/pricing.py b/app/services/pricing.py index c707030..5dd5d77 100644 --- a/app/services/pricing.py +++ b/app/services/pricing.py @@ -347,13 +347,8 @@ class PricingService: price_lookup = self.get_all_prices_for_products(df['product_id'].unique()) - # Convert the nested dict to a DataFrame - price_df = pd.DataFrame.from_dict(price_lookup, orient='index') # product_id becomes index - price_df.index.name = 'product_id' - price_df.reset_index(inplace=True) - - # Merge onto your main DataFrame - df = df.merge(price_df, on='product_id', how='left') + # Apply price columns + df = df.apply(lambda row: self.apply_price_to_df_columns(row, price_lookup), axis=1) logger.debug(f"Applying pricing algorithm: {ACTIVE_PRICING_ALGORITHIM}")