This commit is contained in:
parent
3199a3259f
commit
64897392f1
@ -121,7 +121,7 @@ class PricingService:
|
||||
row[price_type] = price
|
||||
return row
|
||||
|
||||
def smooth_markup(price, markup_bands):
|
||||
def smooth_markup(self, price, markup_bands):
|
||||
"""
|
||||
Applies a smoothed markup based on the given price and markup bands.
|
||||
Uses numpy for smooth transitions.
|
||||
@ -347,8 +347,13 @@ class PricingService:
|
||||
|
||||
price_lookup = self.get_all_prices_for_products(df['product_id'].unique())
|
||||
|
||||
# Apply price columns
|
||||
df = df.apply(lambda row: self.apply_price_to_df_columns(row, price_lookup), axis=1)
|
||||
# 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')
|
||||
|
||||
logger.debug(f"Applying pricing algorithm: {ACTIVE_PRICING_ALGORITHIM}")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user